Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Weathery
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-07 15:55:48
#include <iostream>
using namespace std;
int main() {
int m, d;
cin >> m >> d;
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},s=0,i;
if (m>8) {
for (i=7;i<m-1;i++) {
s-=month[i];
}
} else {
for (i=6;i>m-2;i--) {
s+=month[i];
}
}
s%=7;
int r=(s+d+11)%7;
if (r==0) cout << 7;
else cout <<r;
return 0;
}