Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: mik
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-10 15:01:29
#include <iostream>
using namespace std;
int main(){
int mon[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
int t=0,m,d;
cin >> m >> d;
if (m < 8) {
t += mon[m-1] - 1;
for (int i=m+1;i<8;i++){
t += mon[i-1];
}
t += 12;
int ans = (d-1+t)%7+1;
cout << ans;
} else if (m == 8) {
int ans = (d-1+11)%7+1;
cout << ans;
} else {
t += mon[7] - 12;
for (int i=9;i<m;i++) {
t += mon[i-1];
}
t += 1;
int ans = (d-1-t)%7;
if (ans < 0) ans += 7;
ans += 1;
cout << ans;
}
return 0;
}