hdu1017

http://acm.hdu.edu.cn/showproblem.php?pid=1017

 1 #include<iostream>
 2 #include<stdio.h>
 3 #include<math.h>
 4 #include<string.h>
 5 #include<iostream>
 6 using namespace std;
 7 int main()
 8 {
 9     //freopen("in.txt","r",stdin);
10     int t;
11     scanf("%d",&t);
12     while(t--)
13     {
14         int Case=1;
15         int n,m;
16         while(1)
17         {
18             cin>>n>>m;
19             int count=0;
20             if(!n&&!m)
21             break;
22             for(int a=1;a<n;a++)
23             {
24                 for(int b=a+1;b<n;b++)
25                 {
26                     if((a*a+b*b+m)%(a*b)==0)
27                     count++;
28                 }
29             }
30             printf("Case %d: %d\n",Case++,count);
31         }
32         if(t!=0)
33         printf("\n");
34     }
35     return 0;
36 }

 

posted @ 2015-05-08 19:09  煎饼馃子  阅读(160)  评论(0)    收藏  举报