Submission
Status:
P-PP-PPPP-
Subtask/Task Score:
70/100
Score: 70
User: ChanakanStudy
Problemset: เลขดวง
Language: cpp
Time: 0.003 second
Submitted On: 2026-10-11 22:48:16
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <numeric>
#include <iomanip>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int lastday , posday , birthday;
cin >> lastday >> posday >> birthday;
int luckyday = 0;
if(birthday - 7 > 0) {
luckyday += birthday - 7;
}
if(birthday + 7 <= lastday) {
luckyday += birthday + 7;
}
if((birthday + posday -1 % 7 != 0) && (birthday <= lastday)) {
luckyday += birthday + 1;
}
if((birthday + posday - 1 % 7 != 1) && (birthday > 0)) {
luckyday += birthday - 1;
}
cout << luckyday;
return 0;
}