// File Name: hdu1017.cpp
// Author: Toy
// Created Time: 2013年03月09日 星期六 17时46分05秒
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cctype>
#include <cmath>
#include <string>
#include <algorithm>
#include <cstdlib>
using namespace std;
int Case, n, m, ans, k;
int main ( ) {
cin >> Case;
for ( int i = 0; i < Case; ++i ) {
k = 1;
while ( cin >> n >> m && n ) {
ans = 0;
for ( int i = 1; i < n; ++i )
for ( int j = i + 1; j < n; ++j )
if ( ( i * i + j * j + m ) % ( i * j ) == 0 ) ans++;
cout << "Case " << k++ << ": " << ans << endl;
}
if ( i < Case - 1 ) cout << endl;
}
return 0;
}
hdu1017 A Mathematical Curiosity
最新推荐文章于 2018-10-08 23:11:11 发布