No.1447 Greedy MtSaka
タグ : / 解いたユーザー数 157
作問者 :
butsurizuki
Problem Statement
MtSaka is currently in a territorial dispute. In it, he managed to occupy $N$ points.
He will rule the interior of the $N$-gon formed by connecting those points.
Given the coordinates of all $N$ points, find $2$ times the area he rules.
Note that the answer is always an integer. It is also guaranteed that the polygon formed by connecting the points in the order given in the input is a convex polygon, and that the points are given in counterclockwise order.
Input
$N$ $X_1\ Y_1$ $X_2\ Y_2$ $\vdots$ $X_N\ Y_N$
Constraints
・$3 \leq N \leq 30$
・$-10000 \leq X_i,Y_i \leq 10000 (1 \leq i \leq N)$
・All input values are integers
・The input satisfies the conditions in the problem statement
Output
Output $2$ times the area of the $N$-gon ruled by MtSaka, as a single positive integer on one line. Print a newline at the end.
Sample
Sample 1
Input
3 1 0 1 1 0 1
Output
1
Isn't that too small?
Sample 2
Input
7 -1 -1 2 -1 2 3 1 5 0 6 -1 5 -2 3
Output
42
Sample 3
Input
6 4 1 9 1 11 4 9 9 7 8 5 5
Output
72
What a complicated shape...
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。