hdu_1017(水水水,坑格式)

 1 #include<cstdio>
 2 #include<cmath>
 3 using namespace std;
 4 int main()
 5 {
 6     int T;
 7     scanf("%d",&T);
 8     while(T--)
 9     {
10         getchar();
11         int n,m,sum;
12         double tm;
13         int cnt = 0;
14         while(~scanf("%d%d",&n,&m)){
15             if(n==0&&m==0) break;
16             sum = 0;
17             for(int a = 1; a < n; a++){
18                 for(int b = a+1; b < n; b++){
19                     tm = ((double)a*a+(double)b*b +(double)m)/(double)(a*b);
20                     if((tm -(int)tm)==0) sum++;
21                 }
22             }
23             printf("Case %d: %d\n",++cnt,sum);
24         }
25         if(T!=0)puts("");//最后一个输出块后没有空行
26     }
27     return 0;
28 }

 

posted on 2017-04-04 07:46  若流芳千古  阅读(347)  评论(0编辑  收藏  举报

导航