public class runnian { public static void main(String[] arge, int sun) { System.out.println("请输入年份"); Scanner in = new Scanner(System.in); int year = in.nextInt(); if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { System.out.println("闰年"); } else { System.out.println("平年"); } System.out.println("请输入月份"); int month = in.nextInt(); switch (month) { case 2: { if ((year % 4) == 0) { System.out.println(month + "月是28天"); } else System.out.println(month + "月是29天"); } break; case 1: break; case 3: break; case 5: break; case 7: break; case 8: break; case 10: break; case 12: System.out.println(month + "月是31天"); break; default: System.out.println(month + "月是30天"); break; } int sum = 0; int weekday = sum % 7; for (int i = 1900; i < year; i++) { if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { sum += 366; } else { sum += 365; } } for(int i=1;i<month;i++){ if(i==2){ if(year%4==0&&year%100!=0||year%400==0){ sum+=29; } else { sum+=28; } } else { if(year%4==0&&year%100!=0||year%400==0){ sum+=30; } else { sum += 30; } } } int days=0; if(month==2){ if(year%4==0&&year%100!=0||year%400==0){ days=29; } else { days=28; } }else if(month==4||month==6||month==9||month==11){ days=30; } else { days=31; } int weekdays=sum%7; System.out.println("日 一 二 三 四 五 六"); for(int i=1;i<=weekdays;i++){ System.out.print(" "); } for(int i=1;i<=weekday;i++){ if(sum%7==6){ System.out.print(i+" "); } else { System.out.print(i+" "); } sum+=1; } } }