Submission
Status:
PPPPPPPPP-P-PPP-PPPP
Subtask/Task Score:
85/100
Score: 85
User: Phi
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.002 second
Submitted On: 2026-03-15 22:05:54
#include <bits/stdc++.h>
using namespace std;
vector<int> m = {31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int mo,d,c=0;
cin>>mo>>d;
if (mo==8){
if ((d+11)%7==0){
cout<<7;
return 0;
}
cout<<(d+11)%7;
return 0;
}
while (mo<8){
d+=m[mo-1];
mo++;
c = 1;
}
if (c==0){
while (mo>8){
d-=m[mo-1];
mo--;
}
}
d+=4;
if (d%7==0)d=7;
else d%=7;
d = (d<0) ? d+7:d;
cout<<d;
}