#P3277. Modified Darts Finish
Modified Darts Finish
Modified Darts Finish
This problem is a modification of a popular darts game. In the traditional game there are 20 sectors numbered 1 to 20. In each sector there are three areas that score the single (value), double (2×value) and triple (3×value) respectively. In addition, the board has a central area with two regions: the small bull (worth M points) and the large bull (worth 2M points, and considered as a double hit).
In this modified game, the sectors are numbered from 1 to K. The scoring in each sector is similar: hitting the single, double, or triple area gives a score of i, 2i, or 3i respectively (for 1 ≤ i ≤ K). The bull’s regions are the same: a hit in the small bull yields M points, and a hit in the large bull yields 2M points. Note that only the double areas (i.e. the hit on the double region of a sector or a hit in the large bull) count as a valid finishing dart.
You are given three integers K, M, and X. Your task is to determine whether it is possible to exactly reach a total of X points using at most 3 darts (you may throw 1, 2, or 3 darts) under the following condition: the final dart thrown must be a double hit (i.e. it must be a hit on a double region of one of the sectors or a hit in the large bull).
For example, with K = 20, M = 25, and X = 170, one winning sequence is to hit two triple 20s (each yielding 60 points) and then finish with a large bull (50 points) because 60 + 60 + 50 = 170. Your answer should be YES
if it is possible, or NO
if it is not.
The scoring can be summarized as follows:
\(\text{Sector hit (single)} = i, \quad \text{Sector hit (double)} = 2i, \quad \text{Sector hit (triple)} = 3i, \quad \text{for } 1 \le i \le K\)
\(\text{Small bull} = M, \quad \text{Large bull (also a double)} = 2M\)
Determine if there exists a sequence of 1, 2, or 3 dart throws whose scores add up exactly to X, with the last dart being one of the valid double hits.
inputFormat
The input consists of a single line containing three space-separated integers:
K
: the maximum sector number (1 to K).M
: the score of the small bull (the large bull is 2*M).X
: the target score to achieve.
outputFormat
Output a single line containing YES
if it is possible to exactly achieve X points under the given conditions, otherwise output NO
.
sample
20 25 170
YES