History

시간 제한1초메모리 제한1024 MB

요약
A년부터 B년까지 각 해에 13일이 금요일인 날이 몇 번인지 세고, 그러한 금요일이 정확히 k번 있는 해의 수를 k = 0부터 12까지 구한다.
난이도

보통10점 중 6점

유형
수학, 시뮬레이션, 구현
정답자
아직 제출이 없습니다

문제

Android Vasya likes the history of the ancient world. He likes to read about various superstitions people had at that time.

Recently Vasya came across a superstition concerning his favorite number 13. It turned out, that ancient people considered this number unlucky and avoided it as much as they could:

  • they wouldn't sit at table if there were exactly 13 people;
  • they didn't use number 13 in numbering floors of a building: 12-th floor was followed by 14-th one;
  • they didn't do anything important on Friday the 13-th.

Vasya was especially amused by the superstition about Friday. How could people think that something bad could happen in such a wonderful day like Friday?

Now Vasya makes a research in the ancient world history covering a period from year AA till year BB. He wonders how many unlucky Fridays this period contains. Help him to cope with 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 style for chronology. According to it the year is leap if its number is a multiple of 400 or if it is a multiple of 4 but is not a multiple of 100. In the leap years February is extended to 29 days.

출력

For every kk from 0 to 12 output how many times in the period from Vasya's research there was a year with exactly kk unlucky Fridays.

힌트

In 2015 Fridays are February 13, March 13 and November 13, and in 2016 is May 13 only.

예제1

  1. 예제 1

    입력
    2015 2016
    
    예상 출력
    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