Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: mrblbb

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-12 22:36:55

#include <stdio.h>

int main(){
    int m,d;
    scanf("%d %d", &m, &d);
    int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int day=0;
    if (m <= 8){
        for (int i=m-1; i<7; i++){
            day += month[i];
        }
        day+= 11;
        for (int i=1; i<=day; i++){
            d++;
            if (d==8){
                d=1;
            }
        }
        printf("%d", d);
    } else{
        for (int i=8; i<m-1; i++){
            day += month[i];
        }
        day+= 31-12+1;
        for (int i=1; i<=day; i++){
            d--;
            if (d==0){
                d=7;
            }
        }
        printf("%d", d);
    }
}