BLMIRINA - Archery Training

Mirana is an archer with superpower. Every arrow she shoots will get stronger the further it travels. Mirana is currently on the way to warzone.

Since the road is still a long way, Mirana remembers about when she's still in training. In each of her training, Mirana stands on the (0,0) point in a cartesian scale. From that point, she must shoot a circle centered in (x,y) with radius r. Everything happens in z=0.

To maximize the arrow's power, Mirana must shoot the furthest point of the enemy possible. Her arrow travels at the speed of light and will instantly stops the moment it touches the target. On the target, determine the coordinate point that Mirana has to shoot to get maximum power. If multiple coordinate exists, choose the one with the lower x value.


First line is T, number of training (T < 100000). Next T lines each contains 3 space separeted integers x, y, and r for each training (1 < r < x,y < 1000)


For each training, output a line containing the coordinate of the arrow's destination separated by space. Output until 6 digit after decimal point.


1 1 1
2 2 1
4 5 2 
0.000000 1.000000
1.088562 2.411438
2.126155 5.699076

hide comments
kush8singh: 2017-06-22 19:35:31

for a test case say 1 179 56 56 , i get answer 147.084593 102.015289 , while the judge apparently accepts 147.084601 102.015294 , which is just slightly different. how do i go about this... here's my code <deleted>

ans: Judge only accept error to 1E-6, that's 0.000001

Last edit: 2017-06-24 09:38:49
vanditi: 2017-05-31 09:43:26

@Andy please check my submission Getting WA

andrewt: 2016-10-06 14:01:38

Last edit: 2016-10-07 09:11:03
susiconfusi: 2016-09-09 10:22:44

@bajaj_18, the arrow stops instantly when it touches the target. Therefore it cannot reach 1.707 1.707. The furthest points are 0 1 and 1 0. The one with the smallest x-value is 0 1.

bajaj_18: 2016-09-08 14:33:50

can anyone explain the test cases...for 1 1 1,the answer should be 1.707 1.707 as then the distance travelled is 2.414 which is more than 1 which is from 0 1.(she stands at the origin and not the centre of the circle)

rajat_kumar: 2016-09-05 10:54:07


Last edit: 2016-09-06 17:35:50
Andy: 2016-09-05 10:04:10

no idea

rajat_kumar: 2016-09-05 08:59:26

@Andy can you plz check my submission i don't get why i am getting wa

Added by:Andy
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU