http://acm.hdu.edu.cn/showproblem.php?pid=1017
代码格式及其恶心,记录一下
#include<iostream> #include<cstdio> #include<cstring> using namespace std ; int main() { int i , j , sum ,Case , n , m ; scanf( "%d" , &Case ) ; { //printf( "\n" ) ; for( int k = 0 ; k < Case ; ++k ) { // printf( "\n" ) ; int flag = 0 ; while( cin >> n >> m ) { if( n == 0 && m == 0 ) break ; sum = 0 ; for( i = 1 ; i < n - 1 ; ++i ) for( j = i + 1 ; j < n ; ++j ) { if( ( i * i + j * j + m ) % ( i * j ) == 0 ) sum++ ; } printf( "Case %d: %d\n" ,++flag , sum ) ; } if( k != Case - 1 ) printf( "\n" ) ; } } return 0 ; }