HDOJ 1017 A Mathematical Curiosity

网吧里写代码,太痛苦了

#include <stdio.h>

int main(){
    int t;
    scanf("%d", &t);
    int n, m, k, count;
    while(t--){
        k=0;
        while(scanf("%d%d", &n, &m),n||m){
            count=0;                
            for(int i=1; i<n-1; i++)
                for(int j=i+1; j<n; j++)
                    if((i*i+j*j+m)%(i*j)==0)
                        count++;
            printf("Case %d: %d\n", ++k, count);
        } 
        if(t!=0) printf("\n");
    }    
    return 0;
}

你可能感兴趣的:(HDOJ 1017 A Mathematical Curiosity)