Submission

Status:

P---P-----

Subtask/Task Score:

20/100

Score: 20

User: Krovmoroz

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2025-11-04 20:29:56

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

int n,k,d,x,pos;

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin >> n >> k >> d;
  
  pos = d-k;
  
  x += ((pos >= 6+k)?d-7:0);
  x += ((pos < n-k)?d+7:0);
  x += ((pos%7 && d > 1)?d-1:0);
  x += (((pos+1)%7 && d < n)?d+1:0);
  
  cout << x;
}