HDU1017 注意下输出格式就可以了,我因此PE了两次啊!伤不起啊!

View Code
 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 
 4 int main()
 5 {
 6     int a,b,n,m,count,ncases;
 7     int N;
 8     scanf("%d",&N); 
 9     while( N-- )
10     {
11        ncases = 1;    
12        while(scanf("%d%d",&n,&m))
13        {
14           if(n==0 && m==0) break;                         
15            count = 0;    
16          for(a = 1; a < n; a++)  
17            for(b = a+1; b < n; b++)
18            { 
19               if((a*a+b*b+m)%(a*b) == 0)  
20                  count++; 
21            }
22            printf("Case %d: %d\n",ncases++,count); 
23        }
24       if(N != 0)    
25          printf("\n");           
26            
27     }
28     system("pause");
29    return 0;
30 }
31          

 

posted @ 2012-08-17 10:51  zhongya  阅读(161)  评论(0编辑  收藏  举报