Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: SnowAveNode

Problemset: เลขดวง

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-19 20:41:34

#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 + 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;
}