Run ID:103530

提交时间:2024-12-28 21:34:18

#include <iostream> using namespace std; // 函数声明,用于判断是否为闰年 bool isLeapYear(int year); int main() { int t; // 存储测试用例的数量 cin >> t; // 输入测试用例的数量 while (t--) { // 对于每个测试用例 int n; // 存储需要判断的年份 cin >> n; // 输入年份 // 判断并输出结果 if (isLeapYear(n)) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; } // 函数定义,用于判断是否为闰年 bool isLeapYear(int year) { if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { return true; // 满足闰年条件 } else { return false; // 不满足闰年条件 } }