#include<stdio.h>
int as(int n)
{
if (n % 400 == 0 || n % 4 == 0 && n % 100 != 0)
return 1;
return 0;
}
int main()
{
int n,s=0,s1=0;
scanf("%d", &n);
for (int i = 1; i < n; i++)
if (as(i))
s++;
char ar[12][5] = { "1月","2月","3月","4月","5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
int d = ((n - 1) * 365 + s+1)%7, arr[12] = { 31,28,31,30,31,30,31,31,30,31,30,31};
if (as(n))arr[1] = 29;
for (int i = 0; i < 12; i++)
{
printf(" %s\n", ar[i]);
printf(" sun mon tue wed thu fri sat\n");
int d1 = (d + s1) % 7; s1 += arr[i];
int q1 = 0;
for (int j = 0; j < d1; j++)
{
printf(" "); q1++;
}
for (int e = 1; e <= arr[i]; e++)
{
printf("%4d", e);
if ((q1 + e) % 7 == 0)printf("\n");
}
printf("\n");
}
return 0;
}
0.0分
0 人评分