Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Gump2011

Problemset: เลขดวง

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-28 20:08:27

#include<bits/stdc++.h>
using namespace std;
int main(){
    int x, s, n;
    cin >> 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;
    }

    cout << ans;
}