每筆測資僅一行,不需用到無限輸入。
P.S. 閏年是能被4整除但不能被100整除的年份,以及能被400整除的年份。
[C++](4ms, 674KB)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int year; | |
cin >> year; | |
if( ( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 ) | |
cout << "a leap year\n"; | |
else | |
cout << "a normal year\n"; | |
return 0; | |
} |
0 意見:
張貼留言