#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main ()
{
int N;
scanf ("%d", &N );
for ( int i = 0; i < N; i ++ )
{
//输出之间存在空行
if (i)
printf ("\n");
int m, n;
int num = 0; //记录看这是第几组数
while ( scanf ("%d %d", &n, &m), m || n ) //水题也WA 了好多次就是这里错了
{
num ++;
int count = 0; //用于记录满足条件的 a b 整数对
for ( int a = 1; a < n; a ++ ) // b
{
for ( int b = a + 1; b < n; b ++ ) // a
{
if ( (a * a + b * b + m) % ( a * b ) == 0 )
count ++;
}
}
printf ("Case %d: %d\n", num, count);
}
}
//system ("pause");
return 0;
}
posted on 2010-09-04 13:26
雪黛依梦 阅读(442)
评论(0) 编辑 收藏 引用 所属分类:
简单题