Submission
Status:
PPPPPPPPP----PP-PPPP
Subtask/Task Score:
75/100
Score: 75
User: qwerty_qaz
Problemset: ปฏิทินวันแม่
Language: c
Time: 0.002 second
Submitted On: 2025-10-11 20:38:55
#include <stdio.h>
int not_less(int start, int stop){
for(int i = 0; i<stop; i++){
start--;
if(start =0) start = 7;
}
}
int main(){
int month_days[] = {31, 28, 31, 30, 31, 30, 31,31,30,31,30,31};
int m,d, sum_day=0, ans;
scanf("%d%d", &m,&d);
if(m ==8){
ans = (11+d)%7;
printf("%d", (ans ==0) ? 7: ans);
}else if( m < 8){
sum_day += 11;
for(int i = 7; i >= m; i--){
sum_day += month_days[i-1];
}
ans = (sum_day+d)%7;
if((ans % 7) == 0) ans = 7;
printf("%d", ans);
} else if(m > 8){
sum_day += 20;
for(int i = 9; i<m; i++){
sum_day += month_days[i-1];
}
ans = not_less(d, (sum_day%7));
printf("%d", ans);
}
return 0;
}