#include <iostream>
using namespace std;
int main()
{
int T;
cin >> T;
for (int i = 0; i < T; i++)
{
int m, n, num1 = 0;
while (cin >> n >> m && (m != 0 || n != 0))
{
num1++;
int num = 0;
for (int a = 1; a < n - 1; a++)
{
for (int b = a + 1; b < n; b++)
if ((a*a + b*b + m) % (a*b) == 0)
num++;
}
cout << "Case "<<num1<<": "<<num << endl;
}
if (i != T - 1)
cout << endl;
}
return 0;
}
杭电OJ 1017
最新推荐文章于 2024-08-01 16:02:51 发布