Special Judge Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)
The game of darts is played by two or more players. Players in turn throw three darts into the dartboard. Initially each player has some number of points, usually 501. Each dart thrown at the dartboard scores some points. This number is subtracted from the player’s points. The first one to reach exactly zero is the winner.
The dartboard looks as shown on a picture. There are 20 sectors arranged around the central circle, called the bull eye. This circle in turn consists of the inner bull eye (or simply the bull eye), and outer bull eye. Outer bull eye’s score is 25, inner bull eye is double outer, which is 50. The outer sectors score the number of points they are marked with. There are also two circular areas going around the board. The outer circle area doubles the points of the sector, and the inner one triples them.
There are additional rules for the last round when the player is to decrease his score to zero. He can do it by throwing from one to three darts. First, the player must decrease it to exactly zero, going below zero is not allowed. Second, the last dart in a game must be double — that is, it must be thrown into the double part of some segment or into the bull eye (which is double outer bull eye).
For example, one correct way to finish the game from 50 points is by throwing darts to “18” and “D16”. Finishing by playing “D20”, “10”, or “20”, “T10” is illegal (the last throw in these cases is not double). Another correct way to win in this case is “Bull”.
Given the number of points left, determine all the ways to finish the game correctly.
The first line of the input file contains n — the number of points left (1 ≤ n ≤ 200).
At the first line of the output file print k — the number of ways to correctly finish the game. After that print k lines, each must contain one correct way to finish the game. Use sector’s value to denote it, preceed it with ‘D’ for double area, ‘T’ for triple area. Use “25” to denote the outer bull eye, “Bull” to denote the bull eye itself.
1 D1 D1
1 2 D1
D1 1 D1
2 1 D1
Andrew Stankevich Contest 16