Hide

Problem C
Convex Polygon Area

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

Input

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.

Output

For each polygon, output its area.

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

Please log in to submit a solution to this problem

Log in