万明宇 • 1个月前
9_7_1_
评论:
#include <iostream> using namespace std; bool isLeapYear(int year) { if (year % 4 == 0) { if (year % 100 == 0) { return year % 400 == 0; } return true; } return false; } int main() { int t; cin >> t; while (t--) { int n; cin >> n; if (isLeapYear(n)) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <iostream>
using namespace std;
bool isLeapYear(int year) {
if (year % 4 == 0) {
if (year % 100 == 0) {
return year % 400 == 0;
}
return true;
}
return false;
}
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
if (isLeapYear(n)) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
return 0;
}