Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
111458 汤奕硕 闰年的数量 C++ Accepted 1 MS 276 KB 550 2025-03-02 11:24:21

Tests(10/10):


Code:

#include <iostream> using namespace std; // 判断年份是否为闰年 bool isLeapYear(int year) { if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { return true; } return false; } int main() { int x, y; cin >> x >> y; // 读取两个年份 int leapYearCount = 0; // 闰年计数 for (int year = x; year <= y; ++year) { if (isLeapYear(year)) { leapYearCount++; } } // 输出闰年数 cout << leapYearCount << endl; return 0; }


Run Info:

------Input------
685 1586
------Answer-----
218
------Your output-----