Submission
Status:
P-PP-------------P--
Subtask/Task Score:
20/100
Score: 20
User: Nasmo
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.005 second
Submitted On: 2026-09-27 18:22:04
#include <iostream>
using namespace std;
int main() {
int m, d;
cin >> m >> d;
int total = 0;
if (m < 8) {
for (int i = m; i < 8; i++) {
if (i == m)
total += (i == 2 ? 28 : (i == 4 || i == 6 ? 30 : 31)) - d;
else if (i == 4 || i == 6)
total += 30;
else
total += 31;
}
total += 12;
int day = (7 - total % 7) % 7;
cout << (day == 0 ? 7 : day);
}
else {
for (int i = 8; i < m; i++) {
if (i == 8 || i == 10)
total += 31;
else
total += 30;
}
total += d - 12;
cout << (7 + total % 7) % 7 + 1;
}
return 0;
}