Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: 8ii8jj

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-13 07:37:47

#include <bits/stdc++.h>
using namespace std;

int main() {
    int  m,d,b;
    cin >> m >> d >> b;
    int day = (d + b)%7 - 1;
    if (day < 0) day = 6;
    int ans=0;
    if (b - 7 >= 1) ans += b-7;
    if (b + 7 <= m) ans += b+7;
    if (day != 0 && b+1 <= m) ans += b+1;
    if (day != 1 && b-1 >= 1) ans += b-1;
    cout << ans;
    return 0;
}