Problem P
Convex Polygon Area

For this problem, you just need to be able to calculate the area of convex polygons.


Input starts with an integer $1 \le n \le 100$, indicating the number of convex polygons. The next $n$ lines each contain one convex polygon description. Each begins with an integer $3 \le m \le 100$ indicating the number of points in the polygon. Following this are $m$ pairs of integers, where each pair represents the $x$ and $y$ coordinates of a vertex. The bounds on the coordinates are $-5\, 000 \le x, y \le 5\, 000$. The vertices are given in counter-clockwise order, and no two vertices are the same. As is typical for a polygon, the last vertex is connected to the first one.


For each polygon, output its area.

Sample Input 1 Sample Output 1
3 1 1 2 1 2 2
4 0 0 10 0 13 5 10 8

Please log in to submit a solution to this problem

Log in