Submission

Status:

PPPPPPPPP--P-PP-PPPP

Subtask/Task Score:

80/100

Score: 80

User: samsenpisardmoo26

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-07 01:09:06

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int m;
    int d;
    cin >> m >> d;
    int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
    
    int day = 0;
    
    if(m < 8)
    {
        while(m!=8)
        {
            day+=month[(m-1)];
            m++;
        }
        day+=11;
        cout << (d+(day%7)-1)%7+1;
    }
    
    else if(m > 8)
    {
        while(m!=8)
        {
            m--;
            day+=month[m-1];
        }
        day-=month[m-1];
        day+=1;
        day+=19;
        cout << (7-d+(day%7))%7+1;
    }
    
    else if(m == 8)
    {
        day+=11;
        cout << (d+(day%7)-1)%7+1;
    }
    
}