#include <iostream> using namespace std; int main() { int n=2; cin >> n; // 判断是否为闰年 if ((n % 4 == 0 && n % 100 != 0) || (n % 400 == 0)) { cout << "yes" << endl; // 是闰年 } else { cout << "no" << endl; // 不是闰年 } return 0; }
#include <iostream> using namespace std; int main() { int n=2; cin >> n; // 判断是否为闰年 if ((n % 4 == 0 && n % 100 != 0) || (n % 400 == 0)) { cout << "yes" << endl; // 是闰年 } else { cout << "no" << endl; // 不是闰年 } return 0; }