HDOJ 1017 (水题)
2017-12-03 16:49
176 查看
给定n,m要求满足(x^2+y^2+m)/ab为整数,然后0<a<b<n。求有多少组a,b;n的范围太小了。肯定是个水题没得跑了。 不过要注意下输出形式就是了。
#include <iostream> using namespace std; int main(){ ios::sync_with_stdio(false);cin.tie(0); int N; cin>>N; while(N--){ int n,m; int i = 1; while(cin>>n>>m){ if(m==0 && n==0) break; int ans=0; for(int a = 1;a < n;a ++) for(int b = a+1;b < n;b ++){ int res=(a*a+b*b+m)%(a*b); if(res == 0) ans++; } cout<<"Case "<<i++<<": "<<ans<<endl; } if(N!=0) cout<<endl; } return 0; }
相关文章推荐
- hdoj 1017(水题)
- [HDOJ4788]Hard Disk Drive(水题)
- HDOJ 1017
- HDOJ 1056 HangOver(水题)
- HDOJ 2107 Founding of HDU(水题)
- HDOJ2006 ( 求奇数的乘积 ) 【水题】
- HDOJ2028 ( Lowest Common Multiple Plus ) 【水题,lcm】
- 【水题】hdoj1219 AC me
- Hdoj 1064 Financial Management(水题)
- HDOJ-1715 斐波那契[大数水题]
- HDOJ - A Mathematical Curiosity(水题)
- [水题][hdoj_1092]A+B for Input-Output Practice (IV)
- HDOJ 2504 又见GCD (水题)
- HDOJ---4287 Intelligent IME[字典树---水题]
- hdoj Numbers 5585 (水题)
- hdoj 5585 Numbers 【水题】
- hdoj--5567--sequence1(水题)
- hdoj 5590 ZYB's Biology 【水题】
- HDOJ 1095 A+B for Input-Output Practice (VII)(水题)
- hdoj2012水题