4426 - 볼록 다각형의 넓이

Time Limit: 1s Memory Limit: 128MB

Submissions: 594 Solved: 349
Description

다각형의 두 점을 잇는 선분들이 다각형 내부에 있따면 이를 볼록 다각형이라 한다. 볼록 다각형의 좌표를 시계 방향으로 입력받고, 면적을 출력하는 프로그램을 작성하시오. 다음은 프로그램의 실행 예시이다.

A polygon is convex if it contains any line segments that connects two points of the polygon. Write a program that prompts the user to enter the number of points in a convex polygon, then enter the points clockwise, and display the area of the polygon. Here is a sample run of the program:

 

Input

* Line 1 :  다각형의 변의 수 T (1~30)

* Line 2 ~ T+1 : 다각형의 꼭지점 좌표를 나타내는 x y

 - x, y는 0보다 크고 1,000 보다 작다

Output

* Line 1 : 다각형의 넓이를 반올림해서 소수점 두자리까지 출력

Sample Input
8
395  304
454  255
467  169
427  93
327  88
275  150
247  213
286  315
Sample Output
The total area is 37718.00
Source

JAVA2015 PE11.15