Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: pxsit
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-03 20:04:41
#include <bits/stdc++.h>
using namespace std;
int main(){
int m,d;
cin >> m >> d;
int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
if(m < 8){
int days = d-1;
for(int i=m;i<8;i++){
days += month[i];
}
days += 12;
days %= 7;
cout << days;
}else if(m == 8){
cout << (d+11)%7;
}else{
int days = d-1;
for(int i=m-1;i>8;i--){
days -= month[i];
}
days-=19;
cout << ((days%7)+7)%7;
}
}