Submission

Status:

PPPPPPPPP----PP-P-PP

Subtask/Task Score:

70/100

Score: 70

User: punzacp555

Problemset: ปฏิทินวันแม่

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-05 22:43:24

#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(0);

    int m, d;
    cin >> m >> d;
    d--;

    int start[] = {-1, 1, 32, 60, 91, 121, 152, 182, 213, 244, 274, 305, 336};

    // target: 224

    if(m > 8) {
        for(int i=start[m]; i>=224; i--) {
            d %= 7;
            d = (!d ? 7 : d);
            d--;
        }
    }else {
        if(d > 224) {
            for(int i=start[m]; i>=224; i--) {
                d %= 7;
                d = (!d ? 7 : d);
                d--;
            }
        }else {
            for(int i=start[m]; i<=224; i++) {
                d %= 7;
                d = (!d ? 7 : d);
                d++;
            }
        }
    }

    cout << d;

    return 0;
}