Problem Statement
You are playing a game of darts. The target in this particular game looks as follows:
- There are F regular sectors. These are worth 1, 2, ..., F points.
- There are F "double points" sectors. These are worth 2, 4, ..., 2*F points.
- There are F "triple points" sectors. These are worth 3, 6, ..., 3*F points.
- There is the bullseye in the middle of the target. The bullseye consists of two sectors: the outer bullseye (worth 25 points) and the inner bullseye (worth 50 points).
You have three darts. What is the largest total number of points you can get if you hit three different sectors?
Definition
- Class:
- SimpleDarts
- Method:
- highestScore
- Parameters:
- int
- Returns:
- int
- Method signature:
- int highestScore(int F)
- (be sure your method is public)
Constraints
- F will be between 1 and 100, inclusive.
Examples
20
Returns: 171
A regular dartboard has numbers 1 through 20. If we want to produce the highest score we can by hitting three distinct sectors, we should hit the triple-20, triple-19, and triple-18 for a total of 3*20 + 3*19 + 3*18 = 171 points.
1
Returns: 78
This tiny target has only five sectors. These are worth 1, 2, 3, 25, and 50 points. Clearly the optimal solution is to score 3 + 25 + 50 = 78 points.
9
Returns: 102
Now the optimal play is to hit the inner bullseye (50), the outer bullseye (25), and the triple-9 (27 points).
2
Returns: 81
3
Returns: 84
4
Returns: 87
10
Returns: 107
11
Returns: 113
12
Returns: 119
13
Returns: 125
14
Returns: 131
15
Returns: 137
16
Returns: 143
17
Returns: 149
18
Returns: 155
19
Returns: 162
47
Returns: 414
74
Returns: 657
97
Returns: 864
100
Returns: 891
8
Returns: 99
98
Returns: 873
24
Returns: 207