| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 87033 | sh25_zhoumy | 展示闰年 | C++ | 通过 | 0 MS | 248 KB | 601 | 2026-04-10 15:18:25 |
#include <iostream> #include <vector> using namespace std; bool isLeap(int year) { if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { return true; } return false; } int main() { int x, y; cin >> x >> y; vector<int> leapYears; for (int i = x; i <= y; i++) { if (isLeap(i)) { leapYears.push_back(i); } } cout << leapYears.size() << endl; for (int i = 0; i < leapYears.size(); i++) { if (i > 0) cout << " "; cout << leapYears[i]; } cout << endl; return 0; }