Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: polikanta
Problemset: เลขดวง
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-12 19:37:39
#include <bits/stdc++.h>
using namespace std;
int main()
{
int total , start , birth;
cin >> total >> start >> birth;
int lucky = 0;
if (birth - 7 >= 1){
lucky += birth - 7;
}
if (birth + 7 <= total){
lucky += birth + 7;
}
int pos = (start + birth - 2) % 7 + 1;
if (pos != 1 && birth - 1 >= 1){
lucky += (birth -1);
}
if (pos != 7 && birth + 1 <= total){
lucky += (birth + 1);
}
cout << lucky << endl;
return 0;
}