Throwing dice
Time limit1sMemory limit1024 MB
Given the side counts of Alice's and Bob's fair dice (each at least 4), decide whether Alice or Bob is more likely to get the strictly larger total, or whether the two chances are equal.
- Level
Medium7 of 10
- Topics
- Probability, Math
- Solved
- No attempts yet
Problem
Alice and Bob are discussing penalty shoot-outs and their randomness. Alice says they might as well be throwing dice to decide the winner. They simulate penalty shoot-outs by each throwing dice, summing the numbers shown, and comparing the sums. The player with the larger sum wins. If the sums are equal, it is a tie.
Even so, a player may have an edge depending on which dice they throw. Alice and Bob want to know which of them has the better edge, judging only from the dice they are about to throw.
Alice has fair dice with sides. For every and , the th die shows face with probability . Alice's score is the sum of the numbers shown by her dice. Bob has fair dice with sides, and his score is defined the same way.
Alice has probability of scoring strictly more than Bob, and Bob has probability of scoring strictly more than Alice. Which probability is the largest?
Input
The input consists of three lines. The first line contains and . The second line contains . The third line contains .
Output
Print a single line with one uppercase word: ALICE if , TIED if , and BOB if .
Constraints
- for all
- for all