Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Newton4566
Problemset: เลขดวง
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-13 18:17:45
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int m, f, bd;
cin >> m >> f >> bd;
int col = (f - 1 + bd - 1) % 7;
int total = 0;
if (bd - 7 >= 1) total += bd - 7;
if (bd + 7 <= m) total += bd + 7;
if (col > 0 && bd - 1 >= 1) total += bd - 1;
if (col < 6 && bd + 1 <= m) total += bd + 1;
cout << total;
return 0;
}