Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: sakuragichan

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-05 15:02:25

#include <iostream>
using namespace std;
int main() {
    int m, d;
    int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    cin >> m >> d;

    int total = 0;
    int answer;

    if (m <= 8){
        for (int i = m; i < 8; i++){
            total += days[i];
        }
        total += 11;
        answer = (d + total) % 7;
    }
    else{
        for (int i = 8; i < m; i++){
            total += days[i];
        }
        total = total - 11;
        answer = (d - (total % 7) + 7) % 7;
    }
    if (answer == 0) answer = 7;
    cout << answer << endl;

    return 0;
}