Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: samsenpisardmoo26

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-07 01:12:10

#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))%7;
    }
    
    else if(m > 8)
    {
        while(m!=8)
        {
            m--;
            day+=month[m-1];
        }
        day-=month[m-1];
        day+=1;
        day+=19;
        cout << (d-(day%7)+7)%7;
    }
    
    else if(m == 8)
    {
        day+=11;
        cout << (d+(day%7))%7;
    }

}