Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: PutterThecityboy

Problemset: ปฏิทินวันแม่

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-07 21:39:02

#include <iostream>
using namespace std;

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

    int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    int diff_days = 0;

    if (m < 8) {
        for (int i = m; i < 8; i++) {
            diff_days += days[i];
        }
        diff_days = diff_days - 1 + 12;
    } 
    else if (m == 8) {
        diff_days = 11;
    } 
    else {
        for (int i = 8; i < m; i++) {
            diff_days += days[i];
        }
        diff_days = -(diff_days - 12 + 1);
    }

    int ans = (d - 1 + diff_days) % 7;
    if (ans < 0) {
        ans += 7;
    }
    ans += 1; 

    cout << ans << endl;

    return 0;
}