Submission

Status:
---P--P------P------

Score: 15

User: Nathlol2

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

Language: c

Time: 0.001 second

Submitted On: 2024-09-26 21:20:28

#include <stdio.h>

int main(){
    int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int day[7] = {1,2,3,4,5,6,7};
    int m, d;
    scanf("%d %d",  &m, &d);
    int daycnt = 0;
    int x = 7;

    for(int i = 0;i<m - 1;i++){
        for(int z = 1;z<=month[i];z++){
            daycnt = daycnt + 1;
        }
    }
    daycnt = daycnt + d;
    //224 = mothers day
    if(daycnt > 224){
        x = 6 - ((daycnt - 224) % 7);
    }else if(224 > daycnt){
        x = (224 - daycnt) % 7;
    }else x = 0;
    printf("%d", day[x]);
}