Back
Close

Leap years

Statement

 Goal

Leap years are years which are multiples of 4, with the exception of centennial years (years that are multiples of 100) that aren’t multiples of 400.

For example :
2020, 2000, and 2400 are leap years.
2015, 1900, and 1800 are NOT leap years.

Given two years (a and b) as an entry, print the number of leap years in between those two years, including the two given years.
Input
Two years a and b.
Output
The number of leap years in between (and including!) the two years given.
Constraints
0 <= a < 10000
0 <= b < 10000
a < b
Example
Input
1800
2400
Output
146

Game modes
Fastest, Shortest

Test cases
Normal Interval (B is leap year) Test
Input
1800 2400
Output
146

Normal Interval (B is leap year) Validate Validator
Input
1900 2800
Output
219

Low Years Test
Input
0 110
Output
27

Low Years Validate Validator
Input
3 120
Output
29

High Years Test
Input
8500 9999
Output
363

High Years Validate Validator
Input
8900 9999
Output
266

Small Interval Test
Input
128 129
Output
1

Small Interval Validate Validator
Input
140 149
Output
3

Big Interval Test
Input
1 9998
Output
2424

Big Interval Validate Validator
Input
0 9999
Output
2425

Solution language

Solution

Stub generator input