Calculating Dart Scores

Image by Tijmen Stam via Wikimedia Commons.
In a game of darts a player throws darts at a board consisting of 20 different sections labelled $1$ to $20$. When the dart hits section $i$ the player scores $i$ points. Each section also contains a double area and a triple area. When the dart hits the double area of section $i$ the player scores $2 i$ points, and when the dart hits the triple area the player scores $3 i$ points, instead of $i$ points. When throwing three darts, the player can therefore score a total of at most $180$ points by throwing all three darts in the triple area of section $20$.

Given a target score, output at most three throw scores such that their sum is equal to the given target score. Note that the centre of the dartboard, which is usually called bullseye, is not taken into account is this problem.


The input consists of a single integer $n$ ($1\leq n \leq 180$), the target score.


If the target score can be achieved, output at most three lines, each of the form “single $d$”, “double $d$”, or “triple $d$”, where $d$ is an integer between $1$ and $20$ (inclusive), such that the sum of these scores is equal to $n$. Otherwise, output “impossible”. If there are multiple valid answers you may output any of them.

Sample Input 1 Sample Output 1
triple 20
triple 20
triple 20
Sample Input 2 Sample Output 2
triple 19
double 15
single 9
Sample Input 3 Sample Output 3
triple 9
CPU Time limit 1 second
Memory limit 1024 MB
Difficulty 2.5easy
Statistics Show
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in