public class four_2007_2014 {
private static boolean isSuitable(int num) { int sqrt = (int)(Math.sqrt(num)); if(sqrt*sqrt == num) { return true; } return false;}private static boolean isTwoOfSame(int num) { int i = num / 100; //百位 int j = (num/10) % 10; //十位 int k = num % 10; if(i == j && i != k) { return true; }else if(i == k && i != j) { return true; }else if(k == j && i != k) { return true; } return false;}public static void main(String[] args) { int num; for(num = 100; num <= 999; ++num) { if(isSuitable(num) && isTwoOfSame(num)){ System.out.println(num); } }}
}