Submission
Status:
----------
Subtask/Task Score:
0/100
Score: 0
User: SnowAveNode
Problemset: เลขดวง
Language: cpp
Time: 0.003 second
Submitted On: 2025-09-19 20:40:30
#include<bits/stdc++.h>
using namespace std;
int func(int value, int n) { return (value >= 1 && value <= n) ? 1 : 0; }
int main() {
int n, m, b, total = 0; cin >> n >> m >> b;
int row = (b + m + 5) / 7, column = ((b + m - 1) % 7 + 6) % 7 + 1;;
if(row > 1) total += func(b-7, n);
if(row < (n + m + 5) / 7) total += func(b+7, n);
if(column > 1) total += func(b-1, n);
if(column < 7) total += func(b+1, n);
cout << total;
}