Submission

Status:

P-PP-------P---P-P--

Subtask/Task Score:

30/100

Score: 30

User: nate213121

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-15 20:57:27

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int m, wd;
    cin >> m >> wd;
    m--;
    wd--;

    vector<int> monthDays = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int currDay = 0;
    for(int i = 0; i <= m - 1; i++)
    {
        currDay += monthDays[i];
    }

    currDay++;
    int mothersDay = 0;
    for(int i = 0; i <= 6; i++)
    {
        mothersDay += monthDays[i];
    }
    mothersDay += 12;

    if(mothersDay == currDay)
    {
        cout << wd;
        return 0;
    }
    int diff = currDay - mothersDay;
    wd += diff;
    wd = (wd % 7 + 7) % 7;
    cout << wd;

    return 0;
}