原題鏈接
注意輸出格式,每一組的case都要重新開始計數。
//模擬 //2014-3-11 08:19:16 #includeint main(){ int t, n, m, a, b, count, time; scanf("%d", &t); while(t--){ time = 1; while(scanf("%d%d", &n, &m), n || m){ for(a = 1, count = 0; a < n - 1; ++a) for(b = a + 1; b < n; ++b) if((a*a + b*b + m) % (a * b) == 0) ++count; printf("Case %d: %d\n", time++, count); } if(t) printf("\n"); } return 0; }