题目简单,格式酸爽..
1 #include <iostream> 2 using namespace std; 3 int ans,n,m,p; 4 int main() 5 { 6 cin>>p; 7 while(p--) 8 { 9 int k=1; 10 while(~scanf("%d%d",&n,&m)&&(n+m)) 11 { 12 ans=0; 13 for(int i=1;i<n;i++) 14 { 15 for(int j=i+1;j<n;j++) 16 { 17 if((i*i+j*j+m)%(i*j)==0) ans++; 18 } 19 } 20 printf("Case %d: %d\n",k++,ans); 21 } 22 if(p) puts(""); 23 } 24 }//2016-04-22 16:40:34