Submission
Status:
P-P-----P-----------
Subtask/Task Score:
15/100
Score: 15
User: qwerty_qaz
Problemset: ปฏิทินวันแม่
Language: c
Time: 0.001 second
Submitted On: 2025-10-11 19:45:33
#include <stdio.h>
int main(){
int month_days[] = {31, 28, 31, 30, 31, 30, 31,31,30,31,30,31};
int m,d, sum_day=0;
scanf("%d%d", &m,&d);
int days_before = 11, days_after = 19;
if(m>8){
sum_day += days_after;
for(int i = 9; i<m; i++){
sum_day += month_days[i-1];
}
int ans = (((d - (sum_day % 7)) + 7) % 7);
if (ans == 0) ans = 7;
printf("%d", ans);
}else{
sum_day += days_before;
for(int i = m+1; i<=7; i++){
sum_day += month_days[i-1];
}
int ans = (d + (sum_day % 7)) % 7;
if (ans == 0) ans = 7;
printf("%d", ans);
}
return 0;
}