HDU 1017 A Mathematical Curiosity
此题不算特别麻烦,但是网页上的样例输入好像有点问题,一开始的N应该是3才对吧。。。希望有知道的童鞋给个指点~~
1 #include <stdio.h> 2 3 int main(){ 4 int N; 5 scanf("%d",&N); 6 while(N--){ 7 int n,m; 8 int a,b; 9 int cas = 1; 10 11 while((scanf("%d%d",&n,&m) != EOF)&&(n || m)){ 12 int count = 0; 13 for(a = 1; a < n; a++){ 14 for(b = a + 1; b < n; b++){ 15 if((a * a + b * b + m) % (a * b) == 0) 16 count ++; 17 } 18 } 19 printf("Case %d: %d\n",cas++,count); 20 } 21 if(N){ 22 printf("\n"); 23 } 24 } 25 return 0; 26 }
大早上帝都突然一阵暴雨,淌着水撑着伞到实验室手机又收到一条坏消息。。。心情真是郁闷到极点唉= =
Everything will be ok in the end. If it is not ok then it is not the end.