Submission
Status:
PPPP-PPP-P
Subtask/Task Score:
80/100
Score: 80
User: Quaoar
Problemset: เลขดวง
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-11 20:17:32
#include <stdio.h>
int main() {
int days;
int wday;
int bday;
int sum = 0;
scanf("%d" , &days);
scanf("%d" , &wday);
scanf("%d" , &bday);
if (wday > 4){
wday = 8 - wday;
}
if (bday - 7 > 0){
sum += bday - 7;
//printf("%d\n" , bday - 7);
}
if (bday + 7 < days + 1){
sum += bday + 7;
//printf("%d\n" , bday + 7);
}
if (((( bday + 1 ) % 7) != wday + 1 ) && (bday + 1 <= days)){
sum += bday + 1;
//printf("%d\n" , bday + 1);
}
if (((( bday - 1 ) % 7) != wday) && (bday - 1 > 0)){
sum += bday - 1;
//printf("%d\n" , bday - 1);
}
printf("%d" , sum);
return 0;
}