#Lutece0180. Friday the Thirteenth
Friday the Thirteenth
Migrated from Lutece 180 Friday the Thirteenth
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Is Friday the really an unusual event?
That is, does the 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 of each month lands on Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday over a given period of years. The time period to test will be from January , to December , for a given number of years, . is non-negative and will not exceed .
There are few facts you need to know before you can solve this problem:
- January , was on a Monday.
- Thirty days has September, April, June, and November, all the rest have except for February which has except in leap years when it has .
- Every year evenly divisible by is a leap year ( so will be a leap year, but the year is not a leap year)
- The rule above does not hold for century years. Century years divisible by are leap years, all other are not. Thus, the century years , , and are not leap years, but is a leap year.
Do not use any built-in date functions in your computer language.
Don't just precompute the answers, either, please.
Input
One line with the integer .
Output
Seven space separated integers on one line. These integers represent the number of times the falls on Saturday, Sunday, Monday, Tuesday, ..., Friday.
Samples
20
36 33 34 33 35 35 34
Resources
USACO TRAINING selected by rectaflex