Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Karatat007

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-02 08:27:32

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n,start,d,total = 0;
    cin >> n >> start >> d;
    int col = (d + start - 2) % 7;
    if(col != 0 and d != 1) total += d-1;
    if(col != 6 and d != n) total += d+1;
    if(d+7 <= n) total += d+7;
    if(d-7 >= 1) total += d-7;
    cout << total;
}