In the game of "Spindie", players take turns spinning a spinner and rolling a die.
On each turn, they spin the spinner three times and roll the die between each pair of spins (i.e. the sequence on a single turn is: Spin
, Roll
, Spin
, Roll
, Spin
). Each spin of the spinner lands on some integer and each roll of the die results in an integer from to . The first spinner number is the base score. Then if a die roll is through , the player adds the next spinner number to their score. If they roll a , the next number is used to multiply their score. The winner is the player with the highest score after a set number of rounds.
Here are some example turns of Spindie:
Spin | Roll | Spin | Roll | Spin | Score |
---|---|---|---|---|---|
The input will contain test cases.
The first line of each test case will consist of an integer representing the number of integers on the spinner, where .
The next line contains the integers on the spinner, through , separated by spaces, where .
The next line will contain five target integers through separated by spaces, where .
For each test case, your program should output a single line consisting of letters. Each letter should represent one of the five targets (in order). If the target represents a possible score in a single round of Spindie, then output a T
. If it is not possible, output an F
.
Note that the sample data below contains only test cases, but the test data will contain .
Sample Input
5
23 74 7 64 47
128605 205 2162 2709 71346
3
26 5 11
407 962 455 21 902
4
23 75 89 24
933 484 13248 102 44640
9
23 61 77 83 12 92 1 7 65
72900 144 5704 145 6370
7
87 20 94 99 14 26 87
241956 177 749331 221 4066
Sample Output
FFTFF
TTFTF
FFTFF
FTTTF
TFTFF
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments