Submission

Status:

PPPPPPPPP----PP-PPPP

Subtask/Task Score:

75/100

Score: 75

User: polikanta

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-08-15 19:21:10

#include <stdio.h>

int main() {
    int m, d;
    int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    scanf("%d", &m);
    scanf("%d", &d);

    int total = 0;

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

    return 0;
}