Darts

Special Judge Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

      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.

Input

      The first line of the input file contains n — the number of points left (1 ≤ n ≤ 200).

Output

      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.

Sample Input

5

Sample Output

7
1 D1 D1
1 2 D1
1 D2
D1 1 D1
T1 D1
2 1 D1
3 D1

Source

Andrew Stankevich Contest 16

Manager

Information
Solved Number24
Submit Number69
Problem Tags
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel