| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 85854 | leo4 | 判断闰年I | C++ | Wrong Answer | 1 MS | 272 KB | 533 | 2024-07-20 20:57:31 |
#include <iostream> using namespace std; bool isLeapYear(int year) { // 如果年份可以被4整除但不能被100整除,或者可以被400整除,则是闰年 return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); } int main() { int year; cout << "Enter a year: "; cin >> year; if( year >= 2000 && year <= 2500) { if (isLeapYear(year)) { cout << year << "leap year" << endl; } else { cout << year << "not leap year" << endl; } } return 0; }
------Input------
2012
------Answer-----
leap year
------Your output-----
Enter a year: 2012leap year