Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Bunkoblong
Problemset: เลขดวง
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-06 19:17:52
#include <stdio.h>
int main(){
int X, S, N;
scanf("%d %d %d", &X, &S, &N);
S--;
int col = (N + S - 1) % 7;
int ans = 0;
if (N > 7) ans += N - 7;
if (N + 7 <= X) ans += N + 7;
if (col > 0 && N > 1) ans += N - 1;
if (col < 6 && N < X) ans += N + 1;
printf("%d", ans);
}