Logo
(追記) (追記ここまで)

15470번 - Fences 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB437313.043%

문제

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.

  • The shape of the land inside the outer tier is a perfect circle C. Let B denote the set of points on the boundary of C.
  • The shape of the land inside the inner tier is a non-self-intersecting polygon P of n vertices. I.e., two edges do not intersect if they don’t share a common vertex. Let V denote the set of vertices of P.
  • All vertices of P have identical minimum distances to C. In other words, for distinct vertices (xu, yu),(xv, yv) ∈ V , we have

\[\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 l1, . . . , ln 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 l1, . . . , ln indicating the lengths of edges of P.

You may assume:

  • 1 ≤ T ≤ 100
  • 3 ≤ n ≤ 10
  • 10 ≤ c ≤ 1000
  • l1, . . . , ln > 0
  • P must be inside the circle C.

출력

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.

제한

예제 입력 1

2
10.0 3
1 1 1
10.0 4
1 1 1 1

예제 출력 1

7.524734452702549
6.9577471545947684

힌트

출처

ICPC > Regionals > Asia Pacific > Taiwan > Taiwan Online Programming Contest > TOPC 2017 E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /