Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
145221 李昊阳 08有几个闰年 C++ Accepted 1 MS 272 KB 671 2026-01-25 09:55:16

Tests(10/10):


Code:

#include <iostream> using namespace std; // 判断是否是闰年的函数 bool isLeapYear(int year) { if (year % 400 == 0) { return true; // 是闰年 } else if (year % 100 == 0) { return false; // 不是闰年 } else if (year % 4 == 0) { return true; // 是闰年 } else { return false; // 不是闰年 } } int main() { int a, b, c; cin >> a >> b >> c; // 输入三个年份 int count = 0; // 统计闰年个数 if (isLeapYear(a)) count++; if (isLeapYear(b)) count++; if (isLeapYear(c)) count++; cout << count << endl; // 输出闰年个数 return 0; }