HDACM 1017
注意输出格式
import java.util.Scanner;public class Main{public static void main(String[] args) {int num[] = new int[101];for (int i = 1; i < num.length; i++) {num[i] = i*i;}int sum[][]=new int[101][101];for (int i = 1; i < sum.length; i++) {for (int j = i+1; j < sum.length; j++) {sum[i][j] = num[i]+num[j];}}Scanner sc = new Scanner(System.in);int N = sc.nextInt();while(N-->0){int kase = 1;while(sc.hasNext()){int n = sc.nextInt();int m = sc.nextInt();if (n==0&m==0) {break;}int ans = 0;for (int i = 1; i < n; i++) {for (int j = i+1; j < n; j++) {double s = 1.0*(sum[i][j]+m)/(i*j);if (s-(int)s<0.00000001) {ans++;}}}System.out.println("Case "+kase+++": "+ans);}if (N!=0) {System.out.println();}}sc.close();}
}