Submission

Status:

PPPPPPPPP----PP-PPPP

Subtask/Task Score:

75/100

Score: 75

User: gay69

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-07-27 11:31:42

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

    ll m, d;
    cin >> m >> d;
    ll days = 0;
    if (m < 8) {
        for (int i = m; i < 8; ++i) {
            days += month[i];
        }
    }
    else if (m > 8) {
        for (int i = 8; i < m; ++i) {
            days -= month[i];
        }
    }
    days += (m <= 8 ? 11 : -11);
    cout << (((days % 7) + d - 1 + 7) % 7 + 1) << "\n";
    return 0;
}