1 条题解

  • 0
    @ 2025-11-27 21:05:38
    #include<bits/stdc++.h>
    using namespace std;
    
    int main()
    {
        int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        auto fun = [](int n) {
            int count = 0, res = 0;
            while (n) {
                if (n % 10 == 2) count ++;
                res += n % 10;
                n /= 10;
            }
            return make_pair(count, res);
        };
        int ans = 0;
        for (int yy = 2000; yy <= 2025; yy ++) {
            if (yy % 4 == 0 && yy % 100 != 0 || yy % 400 == 0) days[2] = 29;
            else days[2] = 28;
            for (int mm = 1; mm <= 12; mm ++) {
                for (int dd = 1; dd <= days[mm]; dd ++) {
                    if (yy == 2025 && mm == 12 && dd == 7) break;
                    if (fun(yy).first + fun(mm).first + fun(dd).first < 1) continue;
                    if ((fun(yy).second + fun(mm).second + fun(dd).second) & 1) continue;
                    ans ++;
                }
            }
        }
    
        cout << ans << '\n';
        return 0;
    }
    
    • 1

    信息

    ID
    5631
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    递交数
    168
    已通过
    12
    上传者