Submission
Status:
P-P------P--P-------
Score: 20
User: Nathlol2
Problemset: ปฏิทินวันแม่
Language: c
Time: 0.001 second
Submitted On: 2024-09-25 14:05:59
#include <stdio.h>
int main(){
int x, y;
scanf("%d %d", &x, &y);
int day[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
int cnt = 0;
for(int i = x;i<=day[y - 1];i++){
cnt = cnt + 1;
}
cnt = cnt + 12;
for(int i = y + 1;i<8;i++){
if(day[i - 1] == 31){
cnt = cnt + 31;
}else if(day[i - 1] == 30){
cnt = cnt + 30;
}else{
cnt = cnt + 28;
}
}
int j = cnt % 7;
j = (j + 3) % 7;
printf("%d", j);
}