Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Prap

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2026-04-10 17:07:06

#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;
int main() {
	int A,B,C;
	cin>>A>>B>>C;
	int ans = 4 * C;
	if (C == 1) {
		cout<<10;
		return 0;
	}
	if (C == A) {
		cout<<2*C-8;
		return 0;
	}
	if (C <= 7) {
		ans-=(C-7);
	}
	if (C > A-7) {
		ans-=(C+7);
	}
	if (C%7 == (9-B)%7){
		ans-=(C-1);
	}
	if ((B+C)%7 == 1) {
		ans-=(C+1);
	}
	cout<<ans;
	return 0;
}