QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#653519#7176. I Flipped The Calendar...no_RED_no_DEADWA 0ms3668kbC++201.3kb2024-10-18 20:13:402024-10-18 20:13:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-18 20:13:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3668kb
  • [2024-10-18 20:13:40]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

const ll N = 3000 + 1;
const ll M = 1e9 + 7;
const vector<ll> O = {1, 3, 5, 7, 8, 10, 12};
const vector<ll> E = {2, 4, 6, 9, 11};

ll n;
ll f[13][N];

void doTest(ll testID) {
    auto isLeap = [&](ll year) -> bool {
        if (year % 400 == 0) return true;
        if (year % 100 == 0) return false;
        return year % 4 == 0;
    };

    auto getDay = [&](ll month, ll year) -> ll {
        for (auto x: O) if (month == x) return 31;
        for (auto x: E) if (month == x) return 30;
        if (isLeap(year)) return 29;
        return 28;      
    };

    cin >> n;
    ll cur = 3;
    for (int i = 1970; i <= 2037; i ++) {
        for (int j = 1; j <= 12; j ++) {
            ll num = getDay(j, i);
            ll res = 1; num -= (6 - cur + 1);
            while (num >= 7) num -= 7, res ++;
            if (num != 0) res ++;
            cur = num;
            f[j][i] = res;
        }
    }

    ll res = 0;
    for (int i = 1; i <= 12; i ++) res += f[i][n];
    cout << res;
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int test = 1; 
    // cin >> test;
    for (int _ = 1; _ <= test; _ ++) doTest(_);
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3668kb

input:

2023

output:

63

result:

ok 1 number(s): "63"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

1970

output:

63

result:

ok 1 number(s): "63"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3584kb

input:

1971

output:

63

result:

wrong answer 1st numbers differ - expected: '61', found: '63'