| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 85855 | leo4 | 判断闰年I | C++ | Wrong Answer | 0 MS | 272 KB | 550 | 2024-07-20 21:02:23 |
#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 between 2000-2500: "; cin >> year; if( (year >= 2000) && (year <= 2500) ) { if (isLeapYear(year)) { cout << "leap year" << endl; } else { cout << "not leap year" << endl; } } return 0; }
------Input------
2012
------Answer-----
leap year
------Your output-----
Enter a year between 2000-2500: leap year