Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: onlyme910
Problemset: เลขดวง
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-08 20:17:04
#include <bits/stdc++.h>
using namespace std;
int main(){
int d,s,p,ans = 0;cin >> d>> s>>p;
s -= 1;
int w = (p+s)/7;
int day = (p+s)%7;
if (w != 0 && p - 7 > 0) ans += p - 7;
if (w != 4 && p + 7 <= d) ans += p + 7;
if (day != 0 && p + 1 <= d) ans += p + 1;
if (day != 1 && p - 1 > 0 ) ans += p - 1;
cout << ans;
}