Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: nate213121

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-09-15 21:07:36

#include <bits/stdc++.h>

using namespace std;

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

    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;
    int diff = mothersDay - currDay;
    wd--;
    wd += diff;
    wd = (wd % 7 + 7) % 7;
    cout << wd + 1;

    return 0;
}