Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
110653 汤奕硕 08有几个闰年 C++ Accepted 1 MS 268 KB 629 2025-02-22 16:47: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 a, b, c; cin >> a >> b >> c; // 读取三个年份 // 统计闰年的个数 int leapYearCount = 0; if (isLeapYear(a)) { leapYearCount++; } if (isLeapYear(b)) { leapYearCount++; } if (isLeapYear(c)) { leapYearCount++; } // 输出闰年的个数 cout << leapYearCount << endl; return 0; }