Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: tha_smith

Problemset: เลขดวง

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-27 19:32:13

#include <iostream>
using namespace std;

int main() {
	int alld,first,bday,sum=0,col;
	cin >> alld >> first >> bday;
	first--;
	col = (first + bday - 1)%7;
	
	if(bday>7) {   //1 always above 7
	    sum += bday- 7;
	}
	if(bday+ 7 <= alld) {
	    sum += bday+ 7;
	}
	if(col>0 && bday>1) {
	    sum += bday- 1;
	}
	if(col<6 && bday<alld) {
	    sum += bday+ 1;
	}
	cout << sum;
}