hdu1017

来源:互联网 发布:淘宝助理韵达模板下载 编辑:程序博客网 时间:2024/06/08 03:09
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 }

 

原创粉丝点击