P1183 Area of a Polygon
Description
Given a simple polygon without holes whose edges are vertical or horizontal, compute the area of the polygon.
The polygon is placed on an $xOy$ Cartesian plane, and all its edges are parallel to one of the two coordinate axes. The vertex coordinates are given in counterclockwise order. All coordinates are integers, so the area of the polygon is also an integer.
Note: There may be three consecutive vertices that are collinear.
Input Format
The first line contains the number of vertices $n$.
The next $n$ lines each contain the coordinates $x$ and $y$ of a vertex, separated by a space.
The vertices are given one by one in counterclockwise order. The polygon is closed by drawing an edge from the last vertex to the first.
Output Format
One line with a single integer, representing the area of the polygon.
Explanation/Hint
For $100\%$ of the testdata, $1 \le n \le 100$, $-200 \le x, y \le 200$.
Translated by ChatGPT 5