160. Leap Years in a Range
EasyInclusion–Exclusion
Count leap years between a and b inclusive (Gregorian rules: divisible by 4, except centuries not divisible by 400).
Input format
A single line: a b
Output format
The count.
Example 1
Input
2000 2020
Output
6
Example 2
Input
1900 1900
Output
0
Constraints
1 ≤ a ≤ b ≤ 10¹⁸
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…