Friday the Thirteenth
来源:互联网 发布:1463 端口号 编辑:程序博客网 时间:2024/05/22 11:30
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
- Friday the Thirteenth
- Analysis:Friday the Thirteenth
- Friday the Thirteenth(USACO)
- usaco--Friday the Thirteenth
- Friday the Thirteenth
- [USACO] Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- usaco Friday the Thirteenth
- Friday the Thirteenth黑色星期五
- USACO Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- USACO:Friday the Thirteenth
- Friday the Thirteenth
- USACO -Friday the Thirteenth
- vim 用法简介
- 毕业设计代码设计阶段总结(一)
- 一键清除VC工程生成的垃圾文件
- 对于时间格式 08/21 08:21 用 MM/dd HH:mm 格式无法进行匹配的问题
- My USACO Analysis:Greedy Gift Givers
- Friday the Thirteenth
- 毕业之前要做的20件事
- 如何配置 windows 安装盘需要拷贝的文件
- 改变控件的大小和位置(关于MoveWindow()或SetWindowPos())
- 如何通过命令行注销网络共享
- Analysis:Friday the Thirteenth
- 水晶报表
- 网站架构设计师
- windows系统如何设置自动登录