Submission
Status:
PPPPPPPPP----PP-PPPP
Subtask/Task Score:
75/100
Score: 75
User: Newton4566
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.005 second
Submitted On: 2026-09-21 11:30:44
#include <iostream>
#include <string>
using namespace std;
int main() {
int m, d;
cin >> m;
cin >> d;
if (m <= 8) {
m += 4;
}
else if (m > 8) {
m -= 8;
}
int months[12] = {30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31}; //last is august
int remainingDays = 0;
for (int i = m - 1; i < 11; i++) {
remainingDays += months[i];
}
remainingDays += 11;
int day = (remainingDays + d) % 7;
cout << day << endl;
return 0;
}