Submission

Status:

PPPPPPPPP-

Subtask/Task Score:

90/100

Score: 90

User: SnowAveNode

Problemset: เลขดวง

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-19 20:27:09

#include<bits/stdc++.h>
using namespace std;
int func(int value, int n) {
    if(value < 1 || value > n) return 0;
    else return value;
}
int main() {
    int n, m, b, total = 0; cin >> n >> m >> b;
    int row = (b + m + 5) / 7, column = (b + m - 1) % 7;
    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;
}