CT089

Counting Sundays

MediumAcceptance: 0.0%

You are given the following information: - 1 Jan 1900 was a Monday. - September, April, June, and November have 30 days. - The rest have 31 days, except February which has 28 days, or 29 in a leap year. - A year is a leap year if divisible by 4, but not by 100 unless also by 400. Given a start year and end year (inclusive), find how many Sundays fell on the first of the month during that period. Input format: two space-separated integers: start_year end_year

Example 1:

Input: 1901 2000
Output: 171

Example 2:

Input: 1901 1901
Output: 2

Example 3:

Input: 2000 2000
Output: 1

Constraints:

1900 <= start_year <= end_year <= 2100

Tags:

math dates calendar
Loading...
Test Cases:No test cases
No test cases available.