Problem c
Angel's Journey
Time limit. 1 second
Miyanel" This day Hana aks Miyako for help .again. Hana plays the part oot anuel on the stage show ofthecultural festival, and she is goinetolook FoeeHe oil Hinata. So she must find the shortest path toHinata's house
The area where angels live is a circle, and Hana lives at the bottom of this circie.coordinates of circle's centeris (rx rv) and its radiusisr. Hanawill liveat (rx,ry-r.
; located both outside the circle andApparently, there are many difficulties in this journey. The area which
, . . , . Aouhe area inside the circle is the holy land ofbelow the line y=ry is the sea, so Hana ,, cannot pass this area.
angels, Hana cannot pass this area neither.
However, Miyako canot aluate the length of the shortest path either. For the lveliest Hana in the world,
please help her solve this problem!
Input
Each test file contains several test cases. In each test tile:
The frst line contains a single integer T(1< T s 500) which is the number of test cases.
Each test case contains only one line with five integers: the coordinatesofcenter rx. ry, the radius r, the .coordinates of Hinata's house x. y. The test data guaranteesthat y>ry and (x,y) isout of the circle.
(10-srx,ry,x,ys 103,0
Output
For each test case, you should print one line with youranswer please keep 4 decimal places).
样例
输入
2
1 1 1 2 2
1 1 1 1 3
输出
2.5708
3.8264
思路:过点做圆的切线,切点以前走圆弧,之后走直线。
#include
#include
#include
#include
#include
#include
#include
#include
西安赛怒打一铁,纪念一下封榜后才发现主办方改了样例的题目,同情很多做出了M题但没做出C的队伍,主办方欠你们一块牌。