Leap days in a long contract
A telecom company in Nairobi signs service contracts that run for whole calendar years, and it bills by the day. To forecast revenue it must know how many days a contract covers, which depends on leap years.
A year is a leap year when it is divisible by 4, except years divisible by 100, unless the year is also divisible by 400 (so 2000 is a leap year, 1900 and 2100 are not). A leap year has 366 days, other years have 365.
Task: read two integers on one line, separated by a space: the first and the last year of the contract (both included, first is not larger than last). Print one line in the format leap=3 days=1461 with the number of leap years and the total number of days in all those years.
Sample tests
Input
2020 2024
Expected output
leap=2 days=1827
Input
2026 2030
Expected output
leap=1 days=1826
Your answer is also checked against 4 hidden tests.
Log in or create a free account to run your code, submit and earn points.
Run your code to see the output here. Ctrl + Enter also runs it.
