Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: loop
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-10 18:30:10
#include <iostream>
using namespace std;
int main() {
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int m, d;
cin >> m >> d;
int first = 1; // day of the year of the 1st of month m
for (int i = 1; i < m; i++) first += days[i];
int mom = 12; // day of the year of 12 August
for (int i = 1; i < 8; i++) mom += days[i];
int diff = ((mom - first) % 7 + 7) % 7;
cout << (d - 1 + diff) % 7 + 1 << '\n';
return 0;
}