Submission

Status:

P-PP-----P-------P--

Subtask/Task Score:

25/100

Score: 25

User: Bentley

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-08 21:38:23

#include <bits/stdc++.h>
using namespace std;
int main(){
    int month,day,all=0; cin >> month; cin >> day;
    map<int,int> yrs={{1,31},{2,28},{3,31},{4,30},{5,31},{6,30},{7,31},{8,31},{9,30},{10,31},{11,30},{12,31}};
    
    if(month>8){
        all=31-day+92;
        for(int i=1;i<month;i++){
            all+=yrs[i];
        }
        all+=day;
        cout << all%7;
        return 0;
    }
    else{
        for(int i=1;i<month;i++){
            all+=yrs[i];
        }
        all+=day;
        cout << all%7;
        return 0;
    }
}