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

30223번 - Cut the Cake 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB77302779.412%

문제

Geometry Refresher:

  • A simple polygon is a polygon that does not intersect itself and has no holes. That is, it is a flat shape consisting of straight, non-intersecting line segments or “sides” that are joined pairwise to form a single closed path.
  • A polygon is convex if every line that does not contain any edge intersects the polygon in at most two points.

Given a cake in the shape of simple convex polygon, we would like to cut the cake into two pieces; the single cut (straight line) must go thru two of the polygon vertices. Find the two vertices that will make the two pieces as close (in area) as possible, i.e., the difference in the area for the two pieces is the minimum.

입력

The first input line contains an integer, n (4 ≤ n ≤ 100), indicating the number of vertices in the polygon. This is followed by n input lines. Each of these lines provides the x and y coordinates of a vertex in the polygon (the polygon vertices will be provided in a clockwise order). Assume that all of these input values are integers between 1 and 103, inclusive. Also assume that all the vertices are distinct.

출력

Print the difference (in area) between the largest and smallest pieces, rounded to one decimal point, e.g., 0.74 should be printed as 0.7 and 0.75 should be printed as 0.8.

제한

예제 입력 1

4
6 4
3 4
4 5
5 5

예제 출력 1

1.0

예제 입력 2

5
10 10
8 15
13 16
18 15
16 10

예제 출력 2

15.0

힌트

출처

University > University of Central Florida > 2023 Local Programming Contest (Qualifying Round) 10번

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

출처

대학교 대회

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

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