Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Krovmoroz
Problemset: เลขดวง
Language: cpp
Time: 0.002 second
Submitted On: 2025-11-04 20:49:14
#include <bits/stdc++.h>
using namespace std;
int n,k,d,x=0,pos;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> k >> d;
pos = d+k-2;
x += ((d-7 > 0)?d-7:0);
x += ((d+7 <= n)?d+7:0);
x += ((pos%7 && d > 1)?d-1:0);
x += (((pos+1)%7 && d < n)?d+1:0);
cout << x;
}