Submission

Status:
PPPPPPPPPPPPPPPPPPPP

Score: 100

User: Cmoss9

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

Language: c

Time: 0.001 second

Submitted On: 2024-10-10 09:02:25

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