Submission
Status:
PPPPPPP-P----PP-PP-P
Subtask/Task Score:
65/100
Score: 65
User: thitit
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-06 13:48:06
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
cin.tie(0)->sync_with_stdio(false);
map<int,int> name {
{1,31},
{2,28},
{3,31},
{4,30},
{5,31},
{6,31},
{7,31},
{9,30},
{10,31},
{11,30},
{12,31}
};
int m,d;
cin >> m >> d;
int sum = 0;
int day = 0;
int result;
if (m <=7 ) {
for (int i = m; i < 8; i++) {
sum = sum + name[i];
}
sum = sum + 10;
day = sum % 7;
d = day + d;
result = d % 7;
if (result == 0) {
result = result + 7;
}
} else if (m == 8) {
d = d + 4;
result = d % 7;
} else if (m >= 9) {
for (int i = m; i < 13; i++) {
sum = sum + name[i];
}
sum = sum + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 12;
day = sum % 7;
d = d + day;
result = d % 7;
if (result == 0) {
result = result + 7;
}
}
cout << result;
}