Submission
Status:
PPPPPPPPP----PP-PPPP
Subtask/Task Score:
75/100
Score: 75
User: kanin2208
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.004 second
Submitted On: 2025-12-14 11:34:35
#include <iostream>
using namespace std;
int main() {
int m, d;
cin >> m >> d;
int dayInMonth[13] = {
0, 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
};
int diff = 0;
if (m < 8) {
for (int i = m; i < 8; i++)
diff += dayInMonth[i];
diff += 11;
d = (d + diff) % 7;
}
else if (m > 8) {
diff += 11;
for (int i = 8; i < m; i++)
diff += dayInMonth[i];
d = (d - diff) % 7;
if (d < 0) d += 7;
}
else {
d = (d + 11) % 7;
}
if (d == 0) d = 7;
cout << d;
return 0;
}