Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: bestisyis...programming

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-07 16:01:20

#include <iostream>
using namespace std;
int main(){
	int dofmon,first,bday,sum=0;
	cin >> dofmon >> first >> bday;
	for(int i=1;i<bday;i++){
		first++;
		if(first==8) first = 1;//like mod7
	}
	//cout << first;
	if(bday-7>0) sum+=bday-7;
	if(bday+7<=dofmon) sum+=bday+7;
	if(first-1>0) sum+=bday-1;// no need && bday-1>0 cause 1-1=0
	if(first+1<=7 && bday+1<=dofmon) sum+=bday+1;
	cout << sum;
}