不能更水了,枚举一下完事了。。
#include<stdio.h>
int main()
{
int t, N;
scanf("%d", &N);
for (t = 0; t < N; t++)
{
if (t)
puts("");
int n, m, count = 0;
while (scanf("%d %d", &n, &m), n || m)
{
int a, b, total = 0;
for (a = 1; a < n; a++)
for (b = a + 1; b < n; b++)
if ((a * a + b * b + m) % (a * b) == 0)
total++;
printf("Case %d: %d\n", ++count, total);
}
}
return 0;
}

876

被折叠的 条评论
为什么被折叠?



