标签:
Description
Input
Output
Sample Input
1 10 1 20 3 30 4 0 0
Sample Output
Case 1: 2 Case 2: 4 Case 3: 5
代码:
#include<stdio.h>
#include<string.h>
#include<math.h>
#define N 110
int main()
{
int i, j, t, n, m, f = 0;
scanf("%d", &t);
while(t--)
{
int k = 1;
if(f == 1)
printf("\n");
while(scanf("%d%d", &n, &m), n+m)
{
int ans=0;
for(i = 1; i < n; i++)
{
for(j = 1; j < n; j++)
{
if((i*i+j*j+m) % (i*j) == 0 && (i < j))
ans++;
}
}
printf("Case %d: %d\n", k++,ans);
}
f = 1;
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/dll6/p/5777158.html