Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: koon
Problemset: เลขดวง
Language: cpp
Time: 0.002 second
Submitted On: 2025-11-18 19:18:20
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(false);
int a, b, c; cin >> a >> b >> c;
vector<vector<int>> num(ceil(a/7)+3, vector<int>(9, 0));
int i = 1, l = 1, col = b;
int x, y;
while (i <= a) {
if (col > 7) {
col = 1;
l++;
}
num[l][col] = i;
if (i == c) {
x = l;
y = col;
}
i++; col++;
}
cout << num[x-1][y]+num[x+1][y]+num[x][y-1]+num[x][y+1];
return 0;
}