#include <stdio.h>
int main()
{
int year=0,month=0,weekday=0,sum=0;
printf("请输入年和月:\n");
scanf("%d %d",&year,&month);
for(int y=1900;y<year;y++){
if((y%4==0 && y%100!=0)||y%400==0){
sum+=366;
}else{
sum+=365;
}
}
for(int m=1;m<month;m++){
if(m==2){
if((year%4==0 && year%100!=0)||year%400==0){
sum+=29;
}else{
sum+=28;
}
}else if(m==4||m==6||m==9||m==11){
sum+=30;
}else{
sum+=31;
}
}
sum+=1;
weekday=sum%7;
int count=0;
if(month==2){
if((year%4==0 && year%100!=0)||year%400==0){
count=29;
}else{
count=28;
}
}else if(month==4||month==6||month==9||month==11){
count=30;
}else{
count=31;
}
printf("日\t一\t二\t三\t四\t五\t六\n");
for(int i=1;i<=weekday;i++){
printf("\t");
}
for(int k=1;k<=count;k++){
if(sum%7==6){
printf("%d\n",k);
}else{
printf("%d\t",k);
}
sum++;
}
printf("\n\n");
}