Baking Pans
Time limit1sMemory limit256 MB
For each of up to 1000 triples of pan areas, decide whether two circular cakes from the first two pans fit inside the third pan with a nonzero gap between them.
- Level
Medium6 of 10
- Topics
- Geometry, Math, Binary search, Implementation
- Solved
- No attempts yet
Problem
Maggy loves to bake. She has recently bought three round baking pans of known base area. She baked cakes in the first two of them and intends to take them to a party at a friend's house. However, as carrying two baking pans is quite tricky, it is much more preferable to put both cakes into the third baking pan and carry only it. Maggy cannot really tell whether the cakes will fit. Moreover, she needs to leave some slack between the cakes, as otherwise the icings would mix. Help Maggy out: compute whether the two cakes fit into the third baking pan.
Input
The first line of the input contains one integer , the number of data sets (). One data set consists of three integers , each separated by a single space, denoting the areas of the first, second and third baking pan, respectively.
Output
For each data set you should print a single line containing exactly one word: "TAK" (Polish for "yes") if the cakes from the first and second baking pans fit into the third baking pan together, with a non-zero slack, or "NIE" (Polish for "no") in the other case.