usaco--Friday the Thirteenth
来源:互联网 发布:淘宝商品与描述不符 编辑:程序博客网 时间:2024/05/14 23:09
Friday the Thirteenth
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(USACO)
- usaco--Friday the Thirteenth
- [USACO] Friday the Thirteenth
- usaco Friday the Thirteenth
- USACO Friday the Thirteenth
- USACO:Friday the Thirteenth
- USACO -Friday the Thirteenth
- USACO Friday the Thirteenth
- USACO Friday the Thirteenth
- USACO--Friday the Thirteenth
- usaco Friday the Thirteenth
- usaco Friday the Thirteenth
- usaco Friday the Thirteenth
- USACO 1.1-Friday the Thirteenth
- usaco 1.1:Friday the Thirteenth
- USACO 1.1 Friday the Thirteenth
- USACO之Friday the Thirteenth
- 【USACO】PROB Friday the Thirteenth
- const修饰符
- 说说大型高并发高负载网站的系统架构
- 如何解决GridView在本地和服务器上数据显示的不一致?
- 从软件工程师到IT猎头续:告诉你如何写简历
- 微软造福Win7用户 虚拟XP无需CPU特殊支持
- usaco--Friday the Thirteenth
- ArrayList底层采用数组
- Windows程序设计学习笔记(1)—— Hello world
- 线程学习笔记
- UTU2440开发板中tftp的使用
- 根据列名查表名
- 从程序员到测试工程师(转贴)
- Web 设计与开发终极资源大全(上)
- ASP.NET2.0中meta中包含,将无法使用。