Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Newton4566

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-21 22:41:31

#include <iostream>
using namespace std;

int main() {
    int m, d, bd;
    cin >> m >> d >> bd;

    int col = (d - 1 + bd - 1) % 7;

    int total = 0;
    if (bd - 7 >= 1) total += bd - 7;

    if (bd + 7 <= m) total += bd + 7;

    if (col > 0 && bd - 1 >= 1) total += bd - 1;

    if (col < 6 && bd + 1 <= m) total += bd + 1;

    cout << total << endl;

    return 0;
}