Problem F
Polygon Area
Compute the area of a simple polygon, and the direction (clockwise or counterclockwise) in which its vertices are given.
Input
Input contains up to $25$ test cases. Each test case begins with an integer $n$ ($3 \leq n \leq 1\, 000$). Then follow the $n$ vertices of a simple polygon, one per line, each of the form $x\ y$. The points may be given in either clockwise or counterclockwise order. Coordinates are integers with absolute value bounded by $10\, 000$. The input is terminated by a case beginning with $0$.
Output
For each test case, output a line $D\ A$, where $D$ is one of “CW” or “CCW”, indicating whether the polygon was given in clockwise or counterclockwise order, respectively. $A$ is the area of the polygon, given with exactly one digit after the decimal point.
Sample Input 1 | Sample Output 1 |
---|---|
3 0 0 10 0 0 10 5 41 -6 -24 -74 -51 -6 73 17 -30 -34 0 |
CCW 50.0 CW 3817.5 |