TopcoderArchiveVisit Topcoder
Archive29 Jun 2018
TCC India 2018 Qual

SimpleDarts

Problem statement, definition, constraints, and public examples.

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

  1. 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.
  2. 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.
  3. 9
    Returns: 102
    Now the optimal play is to hit the inner bullseye (50), the outer bullseye (25), and the triple-9 (27 points).
Back to all problems