시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
3 초 | 512 MB | 4 | 3 | 1 | 100.000% |
Your friend, Donald, has a villa surrounded by two tiers of fences, and he wants to calculate the area of land between them. He can measure the length of any fence, but Donald has no idea on calculating the area. Watson, one of Donald’s friends, notices that the fences are probably built by a computer scientist mastering the knowledge of computational geometry, because the following facts are no coincidence.
\[\min_{(x,y) \in B}{\sqrt{\left(x-x_u\right)^2 + \left(y-y_u\right)^2}} = \min_{(x,y) \in B}{\sqrt{\left(x-x_v\right)^2 + \left(y-y_v\right)^2}}\]
Suddenly, you know how to calculate the area of land between the two tiers of fences from the total length c of outer tier and the lengths ℓ1, . . . , ℓn of the n edges of P. Note that Donald can measure these length. Could you help him to calculate the area?
The first line of the input contains a positive integer T indicating the number of test cases. Each test case consists of two lines. The first line contains two numbers c and n separated by a space. c is the total length of the outer tier, i.e., c is the perimeter of C. n is the number of vertices of P. The second line contains n positive integers ℓ1, . . . , ℓn indicating the lengths of edges of P.
You may assume:
For each case, output the area between the two tiers of fences. Your answer will be accepted if the absolute error or the relative error is less than 10−6.
2 10.0 3 1 1 1 10.0 4 1 1 1 1
7.524734452702549 6.9577471545947684
ICPC > Regionals > Asia Pacific > Taiwan > Taiwan Online Programming Contest > TOPC 2017 E번