10113 - 13号星期五

13号又是星期五是一个不寻常的日子吗?13号在星期五比在其他日少吗?为了回答这个问题,写一个程序来计算在n年里13日落在星期一,星期二......星期日的次数.这个测试从1900年1月1日到1900+n-1年12月31日.n是一个非负数且不大于400. 这里有一些你要知道的: 1900年1月1日是星期一.4,6,11和9月有30天.其他月份除了2月都有31天.闰年2月有29天,平年2月有28天.年份可以被 4整除的为闰年(1992=4*498 所以 1992年是闰年,但是1990年不是闰年)以上规则不适合于世纪年.可以被400整除的世纪年为闰年,否则为平年.所以,1700,1800,1900 和2100年是平年,而2000年是闰年.请不要预先算好数据!

输入

一个整数n.

输出

七个在一行且相分开的整数,它们代表13日是星期六,星期日,星期一...星期五的次数.

样例

输入

20

输出

36 33 34 33 35 35 34

提示

Is Friday the 13th really an unusual event? That is, does the 13th of the month land on a Friday less often than on any other day of the week? To answer this question, write a program that will compute the frequency that the 13th of each month lands on Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday over a given period of N years. The time period to test will be from January 1, 1900 to December 31, 1900+N-1 for a given number of years, N. N is non-negative and will not exceed 400. There are few facts you need to know before you can solve this problem: • January 1, 1900 was on a Monday. • Thirty days has September, April, June, and November, all the rest have 31 except for February which has 28 except in leap years when it has 29. • Every year evenly divisible by 4 is a leap year (1992 = 4*498 so 1992 will be a leap year, but the year 1990 is not a leap year) • The rule above does not hold for century years. Century years divisible by 400 are leap years, all other are not. Thus, the century years 1700, 1800, 1900 and 2100 are not leap years, but 2000 is a leap year. Do not use any built-in date functions in your computer language. Don't just precompute the answers, either, please. PROGRAM NAME: Friday

INPUT FORMAT One line with the integer N.

SAMPLE INPUT (file friday.in) 20

OUTPUT FORMAT Seven space separated integers on one line. These integers represent the number of times the 13th falls on Saturday, Sunday, Monday, Tuesday, ..., Friday.

SAMPLE OUTPUT (file friday.out) 36 33 34 33 35 35 34

时间限制 1 秒
内存限制 128 MB
统计
上一题 下一题