How Many Leap Years From 2000


Submit solution

Points: 10
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
Java 19, Java 8

題目說明

輸入西元年n, 計算從西元2000年至n(包括2000和n)歷經多少次閏年 (2000 <= n <= 3000, n:整數)

閏年規則
(1)每四年一閏年,也就是每逢四的倍數即閏年 (Ex: 西元2004年)
(2)但逢百年不閏 (Ex: 西元100, 200, 300年不閏年)
(3)每四百年補閏一次 (Ex: 西元400、800年補潤一次)

輸入

西元年(2000 <= n <= 3000, n:整數)

輸出

歷經多少次閏年

sample input & output

輸入 輸出
DataSet1 2100 25
DataSet2 2024 7
DataSet3 2003 1

Comments

There are no comments at the moment.