# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Abdullah, Biswas and Cijsan all have been in big trouble. They are invited into a dying game by Thanos. If they lose in that game, they will die and the world will suffer a lot. The game is completely mathematical. Abdullah, Biswas and Cijsan are standing at three different places in a field. Thanos is at the center of the distance of any two of them. Seeing this, the other person has to tell how far he is from Thanos. If he can’t, their situation will be worse. But Thanos will leave the world if he can. Sadly, none of them have much mathematical intelligence and I don’t want to say about their guessing ability! Now you can save them and the world.

At first, a number **T** will be given as input, which will indicate the case number. There will be two lines of input for each case. In the first line, a total of six numbers **A _{x} , A_{y} , B_{x} , B_{y} , C_{x} , C_{y}** will be given as input which will indicate the position of Abdullah, Biswas and Cijsan respectively. In the second line, one of the characters

`A`

, `B`

or `C`

will be given as input, which will indicate who should calculate distance from Thanos, whether it’s Abdullah, Biswas or Cijsan.**Constraints**

- 1 ≤
**T**≤ 50 - |
**A**|, |_{x}**A**|, |_{y}**B**|, |_{x}**B**|, |_{y}**C**|, |_{x}**C**| ≤ 500_{y}

The format of the output is like this- `Case X: Y`

. Where **X** is the case number and **Y** is the calculated distance. Print the distance value up to three decimal places for the accuracy of the answer.

Input | Output |
---|---|

2 3 4 6 7 8 9 B -2 2 -4 -4 3 -3 C | Case 1: 0.707 Case 2: 6.325 |

Problemsetter: **Mushfiqur Rahman (mdvirus)**

94% Solution Ratio

StarscreamEarliest,

StarscreamFastest, 0.0s

StarscreamLightest, 0 B

XuhayerShortest, 315B

Login to submit

ATOEB: কোডshock_ 2019 Ended |