1: import java.util.*;
2: public class rili {
3: public static void main(String[] args) {
4: int k=0;
5: Scanner in= new Scanner(System.in);
6: System.out.print("请输入年份:");
7: int year=in.nextInt();
8: System.out.print("请输入月份:");
9: int month=in.nextInt();
10: int sum=0;
11: for(int i=1900;i
12: if(i%4==0&&i%100!=0||i%400==0){
13: sum+=366;
14: }else{
15: sum+=365;
16: }
17: }
18: for(int i=1;i
19: if(i==2){
20: if(year%4==0&year%100!=0||year%400==0){
21: sum+=29;
22: }else{
23: sum+=28;
24: }
25: }else if(i==4||i==6||i==9||i==11){
26: sum+=30;
27: }else{
28: sum+=31;
29: }
30: }
31: sum+=1;
32: if(month==2&&(year%4==0&year%100!=0||year%400==0)){
33: k=29;
34: }else if(month==4||month==6||month==9||month==11){
35: k=30;
36: }else{
37: k=31;
38: }
39: System.out.println("日\t一\t二\t三\t四\t五\t六");
40: int wekday=sum%7;
41: for(int i=1;i<=wekday;i++){
42: System.out.print("\t");
43: }
44: for(int i=1;i<=k;i++,sum++){
45: if(sum%7==6){
46: System.out.print(i+"\n");
47: }else{
48: System.out.print(i+"\t");
49: }
50: }
51: }
52: }