Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
78456 sh25_wanghy 展示闰年 C++ Accepted 0 MS 252 KB 550 2025-12-26 15:46:55

Tests(1/1):


#include <iostream> #include <vector> using namespace std; // 判断闰年函数 bool isLeapYear(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); } int main() { int x, y; cin >> x >> y; vector<int> leapYears; for (int year = x; year <= y; ++year) { if (isLeapYear(year)) { leapYears.push_back(year); } } cout << leapYears.size() << endl; for (int year : leapYears) { cout << year << " "; } cout << endl; return 0; }


Judgement Protocol: