Submission
Status:
PPPPPPPPP----PP-PPPP
Subtask/Task Score:
75/100
Score: 75
User: peilin
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-12 17:04:07
#include <iostream>
using namespace std;
void solve() {
const int DAYS_IN_MONTH[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int m;
int d;
if (!(cin >> m >> d)) return;
const int TARGET_MONTH_INDEX = 7;
const int TARGET_DAY = 12;
long long total_days_difference = 0;
for (int month_idx = m - 1; month_idx < TARGET_MONTH_INDEX; ++month_idx) {
total_days_difference += DAYS_IN_MONTH[month_idx];
}
total_days_difference += (TARGET_DAY - 1);
long long day_shift = total_days_difference % 7;
int final_day_number = (d + day_shift - 1) % 7 + 1;
cout << final_day_number << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}