Submission

Status:

P-P-----------------

Subtask/Task Score:

10/100

Score: 10

User: peilin

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

Language: c

Time: 0.002 second

Submitted On: 2025-10-12 14:57:53

#include <stdio.h>

int main() {
    int month_days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int m, d;
    scanf("%d %d", &m, &d);

    int total_days = 0;
    for(int i = m; i < 8; i++) {
        total_days += month_days[i];
    }
    total_days = total_days - (month_days[7] - 12);
    int result = (d - 1 + total_days) % 7;
    if(result == 0) result = 7;
    printf("%d\n", result);
    return 0;
}