Practice on Toph

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

Trap of Thanos

By mdvirus · Limits 1s, 1.0 GB

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.

Input

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 Ax , Ay , Bx , By , Cx , Cy 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
  • |Ax|, |Ay|, |Bx|, |By|, |Cx|, |Cy| ≤ 500

Output

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.

Sample

InputOutput
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)

Discussion

Statistics


94% Solution Ratio

StarscreamEarliest, 3M ago

StarscreamFastest, 0.0s

StarscreamLightest, 0 B

XuhayerShortest, 315B

Submit

Login to submit

Related Contests

ATOEB: কোডshock_ 2019 Ended at 2019-12-19 11:30:00 +0000 UTC