提交时间:2023-01-12 15:50:15
运行 ID: 4605
#include<iostream> #include<vector> using namespace std; int main(){ int num; int year; cin >> num; vector<bool> vec; while (num--){ cin >> year; bool is_leap_year; if (year%100==0){ if (year%400==0){ is_leap_year = true; vec.push_back(is_leap_year); } else { is_leap_year = false; vec.push_back(is_leap_year); } } else if (year%4==0){ is_leap_year = true; vec.push_back(is_leap_year); } else { is_leap_year = false; vec.push_back(is_leap_year); } } for (int i=0; i<vec.size(); i++){ cout << (vec[i] == true ? "Yes":"No") << endl; } return 0; }