package test; public class 猜生日 { public static void main(String arg[]) { for(int i = 20110630;;i--) { String str=""+i; int year=Integer.parseInt(str.substring(0, 4)); int month=Integer.parseInt(str.substring(4, 6)); int day=Integer.parseInt(str.substring(6, 8)); if(!(i%2012==0&&i%3==0&&i%12==0)) continue; if(month!=6) continue; if(day>31||day==0) continue; System.out.println(i); break; } } }