Submission
Status:
P--P--PPP-
Subtask/Task Score:
50/100
Score: 50
User: Kei
Problemset: เลขดวง
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-07 16:02:46
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
int nmo,first,bd,thesum=0;
//sun to S
cin>>nmo>>first>>bd;
//+1-1 +7-7;
//find septenary
int septen = first+bd%7;
if(bd==nmo ? thesum+=bd-1 : thesum+=(2*bd));
if(septen == 1) thesum=thesum-bd+1;
else if(septen==0) thesum=thesum-bd-1;
if(bd+7>nmo ? thesum+=bd-7 : thesum+=(2*bd));
cout << thesum;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}