#include <stdio.h>
int monday(int month, int year)
{
int maxday;
int r[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int p[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0)
{
    maxday = r[month - 1];
}
else
{
    maxday = p[month - 1];
}
return maxday;
}
int main()
{
int year, month, day, hour, min, sec, maxday;

for (year = 2020; year <= 2050; year++)
{

    for (month = 1; month <= 12; month++)
    {

        maxday = monday(month, year);

        for (day = 1; day <= maxday; day++)
        {

            for (hour = 0; hour < 24; hour++)
            {

                for (min = 0; min < 60; min++)
                {

                    for (sec = 0; sec < 60; sec++)
                    {

                        printf("%4d年 %2d月 %2d日 %2d时 %2d分 %2d秒平安\n", year, month, day, hour, min, sec);
                    }
                }
            }
        }
    }
}
}