In the Price Is Right’s game Cover Up, players test their luck to win a new car. To win, the player must produce the actual retail price of the car from a board of possible numbers like:
9
3 4
0 4 7
9 6 7 3
1 4 8 2 6
3 2 4 0 8
9 9 9
3 4 3 4 3 4
0 4 7 0 4 0 4
9 6 7 3 -> 9 3 -> 9
1 4 8 2 6 8 2 6 2 6
3 2 4 0 8 3 2 4 0 8 3 2 4 0 8
| | | | | | | |
v v v v v v v v1 4 6 7 7 1 4 8 7 3 c c x c x c c x c c INITIAL BID SECOND BID
The sponsor will explore many variations, with prices up to 7 digits long. Therefore, the input file will begin with a line containing the integer N <= 5000, the number of test cases to be explored. The test cases follow.
Each test case begins with the integer d, 0 < d <= 7, the number of digits in the price of the car. d lines will follow, with non-empty strings of distinct digits in the range from 0 through 9. Each of these lines represents a column of the digits in the game. The first line represents the leftmost column; the last the rightmost column. A 0 is possible as the first digit in the price of the car.
Your program will print the probability of the player winning the car, rounded to 3 decimals.
2 2 9 19 5 13 942 0684 34720 947368
1.000 0.321
Migrated from old NTUJ.
No. | Testdata Range | Score |
---|