Submission
Status:
-------PPP-P---P--P-
Score: 30
User: Cmoss9
Problemset: ปฏิทินวันแม่
Language: c
Time: 0.001 second
Submitted On: 2024-10-09 23:02: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==6) {
startingdate = (startingdate+3)%7;
}
else if (i==2) {
startingdate = (startingdate)%7;
}
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;
if (startingdate < 0) {
startingdate = 7 + startingdate;
}
}
else {
startingdate = (startingdate-2)%7;
if (startingdate < 0) {
startingdate = 7 + startingdate;
}
}
}
result = (startingdate+10)%7;
if (result == 0) {
result = 7;
}
printf("%d",result);
}
}