Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: kenkong587
Problemset: เลขดวง
Language: c
Time: 0.003 second
Submitted On: 2026-10-05 17:08:21
#include <stdio.h>
int main(){
int day,first,birth;
scanf("%d %d %d",&day,&first,&birth);
int bday = (birth - 1 + first - 1) % 7 + 1;
int n = birth - 7;
int s = birth + 7;
int e = birth + 1;
int w = birth - 1;
if(n < 1){
n = 0;
}
if(s > day){
s = 0;
}
if(bday + 1 == 8 || e > day){
e = 0;
}
if(bday - 1 == 0){
w = 0;
}
printf("%d",n+s+e+w);
return 0;
}