Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: letdown

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-04 11:03:12

#include <bits/stdc++.h>

using namespace std;

int main() {
    int e, offset, x;
    cin >> e >> offset >> x;
    offset -= 1; 

    int week = (x + offset) / 7;
    int day = (x + offset) % 7;
    
    int answer = 0;

    if (week != 0 && x - 7 > 0) answer += x - 7;
    if (week != 4 && x + 7 <= e) answer += x + 7;
    if (day != 0 && x + 1 <= e) answer += x + 1;
    if (day != 1 && x - 1 > 0 ) answer += x - 1;

    cout << answer << endl;
}