Under construction

Still being built. Things may change

History

Time limit1sMemory limit1024 MB

Summary
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 AA to year BB. He wonders how many unlucky Fridays this period contains. Help him solve this simple task.

입력

The only line contains integers AA and BB (1919≤A≤B≤1091919 \leq A \leq B \leq 10^9). 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 kk from 0 to 12, output how many years in the period have exactly kk 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.

Examples1

  1. Example 1

    Input
    2015 2016
    
    Expected output
    0: 0
    1: 1
    2: 0
    3: 1
    4: 0
    5: 0
    6: 0
    7: 0
    8: 0
    9: 0
    10: 0
    11: 0
    12: 0