QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#253104#6697. CalandarTeal#AC ✓1ms3824kbC++141.1kb2023-11-16 18:01:212023-11-16 18:01:22

Judging History

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

  • [2023-11-16 18:01:22]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3824kb
  • [2023-11-16 18:01:21]
  • 提交

answer

#include <set>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N ()
#define inf (0x3f3f3f3f)
#define INF (0x3f3f3f3f3f3f3f3fll)
#define LL long long
LL T, y, m, d;
string day;
string week[5] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};

inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch > '9')
        ch == '-' ? f = -1, ch = getchar() : ch = getchar();
    while (ch >= '0' && ch <= '9')
        x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    return x * f;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> T;
    while (T--) {
        cin >> y >> m >> d >> day;
        LL res1 = y * 12 * 30 + m * 30 + d;
        cin >> y >> m >> d;
        LL res2 = y * 12 * 30 + m * 30 + d;
        LL now = 0;
        for (int i = 0; i < 5; ++i) 
            if (week[i] == day) now = i;
        // cout << res1 << " " << res2 << " "  << abs(res2 - res1) % 5 << "\n";
        cout << week[((now + res2 - res1) % 5 + 5) % 5] << "\n";
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
2019 5 12 Monday
2019 5 14
2019 5 12 Tuesday
2019 12 30
2019 5 12 Friday
1000000000 1 1
1000000000 1 1 Wednesday
2019 5 12

output:

Wednesday
Friday
Thursday
Thursday

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

100
60523000 9 6 Tuesday
667062297 1 19
818045248 9 22 Wednesday
950448235 4 11
347752308 10 25 Thursday
18640223 2 6
740295050 11 22 Wednesday
185496318 7 25
905846973 3 14 Tuesday
132078200 7 11
748835058 9 22 Wednesday
863118887 3 24
225924970 2 17 Wednesday
807058915 11 19
326750305 4 30 Wednesd...

output:

Friday
Tuesday
Friday
Monday
Thursday
Friday
Friday
Thursday
Monday
Monday
Friday
Tuesday
Thursday
Monday
Friday
Friday
Wednesday
Monday
Tuesday
Thursday
Wednesday
Thursday
Friday
Tuesday
Tuesday
Friday
Monday
Tuesday
Thursday
Monday
Tuesday
Wednesday
Wednesday
Monday
Thursday
Wednesday
Wednesday
Fr...

result:

ok 100 lines