Four Quarters

No attempts yetTime limit1sMemory limit128 MB

Problem

Four Quarters is a game of chance played with four 25-cent coins (quarters). Two players, A and B, each flip two coins every round. Based on the results of their own two coins, each player gains or loses points according to the tables below.

A two-coin result is distinguished only by its number of heads; Heads/Tails and Tails/Heads are treated as the same. So each player’s result is one of HH (2 heads), HT (1 head), or TT (0 heads).

Player A’s payoff (rows: A’s result, columns: B’s result)

A / BB: HHB: HTB: TT
A: HH112
A: HT001
A: TT-100

Player B’s payoff (rows: A’s result, columns: B’s result)

A / BB: HHB: HTB: TT
A: HH0-1-1
A: HT100
A: TT20-1

As you can see, the odds are stacked in Player A’s favor. At the start of the game both players have 0 points, and points accumulate as the game progresses. When the game ends, the player with more points wins.

Write a program that determines the probability that Player A wins, Player B wins, or the game ties after a given number of rounds. Assume the coins are fair, i.e. heads and tails are equally likely.

Input

There is no input for this problem.

Output

Output a table listing the probability that Player A wins, Player B wins, or the game ties after each round, for rounds 1 through 20. Express each probability as a percentage with 4 digits after the decimal point.

Print the header line Round A wins B wins Tie first, then one line per round from 1 to 20, each containing the round number followed by the three probabilities. Match the exact spacing and formatting shown in the example output.