#38543:


judgeking001 (adking)

學校 : 不指定學校
編號 : 195281
來源 : [180.218.90.201]
最後登入時間 :
2024-05-10 17:18:58
f709. 12019 - Doom's Day Algorithm -- UVA12019 | From: [220.143.102.200] | 發表日期 : 2023-12-05 01:56

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    string week[7] = {"Saturday", "Sunday",  "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
    int n;
    cin >> n;
    while (n--) {
        int m, d, sum = 0;
        cin >> m >> d;
        for (int i = 0; i < m - 1; i++) {
            sum += month[i];
        }
        cout << week[(sum + d - 1) % 7] << endl;
    }
    return 0;
}
 
ZeroJudge Forum