Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Kei

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-07 13:40:04

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>; 

void solve(){
    int m,d;
    cin>>m>>d;
    vector<pii> md={
        {1,1},
        {2,32},
        {3,60},
        {4,91},
        {5,121},
        {6,152},
        {7,182},
        {8,213},
        {9,244},
        {10,274},
        {11,305},
        {12,335},
    };
    //12 of 8 ->31+28+31+30+31+30+31+12 -> 224
    int backtrack = md[m-1].second;
    backtrack%7;
    d+=224-backtrack;
    d%=7;
    if(d<=0) d+=7;
    cout << d;

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}