History
Time limit1sMemory limit1024 MB
Given years A to B in the Gregorian calendar, count for each k from 0 to 12 how many years have exactly k Friday the 13ths.
- Level
Medium5 of 10
- Topics
- Math, Implementation, Prefix sum
- Solved
- No attempts yet
문제
Android Vasya likes the history of the ancient world. He enjoys reading about the various superstitions people had at that time.
Recently Vasya came across a superstition about his favorite number 13. Ancient people considered this number unlucky and avoided it as much as they could:
- they would not sit at a table if exactly 13 people were seated;
- they did not use the number 13 when numbering the floors of a building, so the 12th floor was followed by the 14th;
- they did not do anything important on Friday the 13th.
Vasya was especially amused by the superstition about Friday. How could people think that something bad could happen on such a wonderful day as Friday?
Now Vasya is researching the history of the ancient world from year to year . He wonders how many unlucky Fridays this period contains. Help him solve this simple task.
입력
The only line contains integers and (). Androids use the Gregorian calendar. In it, a year is leap if its number is a multiple of 400, or if it is a multiple of 4 but not a multiple of 100. In leap years, February has 29 days.
출력
For every from 0 to 12, output how many years in the period have exactly unlucky Fridays.
힌트
In 2015, the Fridays on the 13th are February 13, March 13, and November 13. In 2016, the only Friday on the 13th is May 13.