1 #include2 #include 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 }