题目格式真恶心,WA无数次。
CODE:
2 #include <math.h>
3
4 #include <stdio.h>
5int main()
6 {
7 int n, m, N;
8 while( scanf( "%d", &N) != EOF )
9 {
10 for( int r=0; r<N; ++r )
11 {
12 int t=1;
13 while( scanf( "%d%d", &n, &m ) != EOF, n+m )
14 {
15 int cnt=0;
16 for( int i=1; i<n; ++i )
17 {
18 for( int j=i+1; j<n; ++j )
19 {
20 int a=i*i+j*j+m;
21 if( a/(i*j)*(i*j)==a )
22 cnt++;
23 }
24 }
25 printf( "Case %d: %d\n", t++, cnt );
26 }
27 if( r<N-1 )
28 puts( "" );
29 }
30 }
31 return 0;
32 }