Submission

Status:

PPPPPPPP--TTTPPTPPPP

Subtask/Task Score:

70/100

Score: 70

User: Nuttykub

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

Language: cpp

Time: 1.098 second

Submitted On: 2026-10-01 09:04:09

#include <bits/stdc++.h>
using namespace std;
int main(){
    int m,d;
    cin >> m >> d;
    int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
    int total = 0;
    if (m > 7){
        for (int i = m-2;i>7;i++){
            total+=month[i];
        }
        total+=20;
        int a = total%7;
        cout << 7-((abs(d-a+1))%7);
        return 0;
    }
    for (int i = m-1;i < 7;i++){
        total+=month[i];
    }
    total+=12;
    int a = total%7;
    cout << (a+d-1)%7;
}