Is Date Correct?
Submit solution
Points:
45 (partial)
Time limit:
1.0s
Memory limit:
64M
Authors:
Problem types
Allowed languages
Java 19, Java 8
題目說明
輸入西元年、月,
判斷日期是否正確
需判斷內容:月份(01~12)、天數(01~28、29、30、31)
【閏年規則】西元年份
為4的倍數但非100的倍數
,或為400的倍數
,為閏年。
舉例:1700年、1800年、1900年、2100年、2200年、2300年為平年。1600年、2000年及2400年為閏年。
輸入
西元年、月、日(中間不含空格)
西元年4位數,月2位數、日2位數
範例:
19880703
輸出
若月份有誤,輸出(input_date) is wrong date.
若天數有誤,輸出(input_date) is wrong date.
無誤則輸出(input_date) is correct date.
測試資料0 輸入
20241330
測試資料0 輸出
20241330 is wrong date.
// 沒有13月
測試資料1 輸入
20010229
測試資料1 輸出
20010229 is wrong date.
// 平年的2月沒有29天
測試資料2 輸入
20240203
測試資料2 輸出
20240203 is correct date.
Comments