Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: angpangSK
Problemset: เลขดวง
Language: cpp
Time: 0.004 second
Submitted On: 2025-09-23 21:52:04
#include <iostream>
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;
int 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;
}