解法一
🔹 閏年判斷
年份能被 4 整除
且不能被 100 整除的年份是閏年
或者,年份能被 400 整除的年份也是閏年
用 and or 表示 :
( 年份能被4整除 and 年份能被100整除 ) or 年份能被400整除
✅ 完整代碼
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int y;
    while(cin >> y){
        if((y%4==0 && y%100!=0) || y%400==0) cout << "閏年\n";
        else cout << "平年\n";
    }
    
    return 0;
}