Submission
Status:
P-P-P-PPPPPP-P-P-PPP
Score: 70
User: Cmoss9
Problemset: ปฏิทินวันแม่
Language: c
Time: 0.002 second
Submitted On: 2024-10-08 12:32:05
#include <stdio.h>
int main () {
int month,startingdate;
int skip;
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) {
skip = 3;
} else if (i==2) {
skip = 0;
} else {
skip = 2;
}
startingdate = (startingdate+skip) % 7;
if (startingdate == 0) {
startingdate = 1;
}
}
startingdate = (startingdate+11)%7;
}
else if (month>8) {
for (int i = month;i>8;i--) {
if (i==10||i==12) {
skip = 3;
} else {
skip = 2;
}
startingdate = (startingdate-skip)%7;
if (startingdate == 0) {
startingdate = 1;
}
}
startingdate = (startingdate+10)%7;
}
else {
startingdate = (startingdate+11)%7;
}
printf("%d",startingdate);
}