Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: nicekrittaphat

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-11 16:10:19

#include <iostream>
using namespace std;

int main(){

    int maxday;
    int starttype;
    int yourday;
    cin>>maxday>>starttype>>yourday;

    bool up=true;
    bool down = true;
    bool left = true;
    bool right = true;


    int res=0;
    //
    if(yourday-7<=0)up = false;
    if((yourday+starttype-1)%7==1) left= false;
    if((yourday+starttype-1)%7==0)right= false;
    if(yourday+7>maxday)down=false;

    if(up)res+=yourday-7;
    if(left)res+=yourday-1;
    if(right)res+=yourday+1;
    if(down)res+=yourday+7;
    cout<<res;
    
}