Bookmakers
InterviewTime limit1sMemory limit128 MB
Decide whether stakes on both match outcomes can guarantee a profit given decimal odds X and Y.
- Level
Easy2 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem
Hector's father has recently taken an interest in sports betting. Soon there will be a match between team Alfa and team Beta.
A nearby bookmaker pays zł for every złoty staked on Alfa winning, if Alfa wins the match. Likewise, if Beta wins, the bookmaker pays zł for every złoty staked on that outcome. (The match cannot end in a draw.)
Hector's father does not want to risk losing money. He wants to know whether he can choose an amount to stake on Alfa winning and an amount to stake on Beta winning so that, no matter how the match ends, he receives back strictly more than .
Write a program that decides whether this is possible.
Input
The first line contains the number of test cases ().
Each of the next lines contains two real numbers () and (), each given with exactly two digits after the decimal point.
Output
For each test case, print on its own line:
TAKif the money can be staked in a way that guarantees a profitNIEotherwise