Submission

Status:
PPPPPPPPP-P-PPP-PPPP

Score: 85

User: Cmoss9

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

Language: c

Time: 0.001 second

Submitted On: 2024-10-09 22:33:14

#include<stdio.h>
int main () {
    int month,startingdate,result;
    scanf("%d %d",&month,&startingdate);
    if (month<=8) {
        for (int i = month;i<8;i++) {
            if (i==1||i==3||i==5||i==7||i==8) {
                startingdate = (startingdate+3)%7;
            }
            else if (i==2) {
                startingdate = startingdate;
            }
            else {
                startingdate = (startingdate+2)%7;
            }
        }
    result = (startingdate+11)%7;
    if (result == 0) {
        result = 7;
        }
    printf("%d",result);
    } else {
        for (int i = month;i>8;i--) {
            if (i==10||i==12) {
                startingdate = (startingdate-3)%7;
            }
            else {
                startingdate = (startingdate-2)%7;
            }
        }
        result = (startingdate+11)%7;
        if (result == 0) {
            result = 7;
        }
    printf("%d",result);
    }
}