Submit | All submissions | Best solutions | Back to list |
POLYGONA - Area of an Irregular Polygon |
This challenge is to calculate the area of an irregular convex polygon. For each test there will be an arbitrarily ordered list of x,y coordinates (integer, -1000 <= x,y <= 1000) for each point in the polygon. For each test there will be N points, where N <= 500.
Input
The first line will contain a single value T for the number of tests, T <= 100.
Each test will begin with a single value N for the number of points in that test, N <= 500. The following N lines will contain the x,y coordinates of the polygon's corners, where x and y are integers in the range -1000 to 1000.
Output
For each test case the output should be the area to one decimal place.
Example
Input: 3 3 0 0 100 0 200 100 4 -60 50 40 -30 60 50 -40 -30 5 0 -30 50 -90 200 0 0 -60 400 -60 Output: 5000.0 8000.0 21000.0
Added by: | Jander |
Date: | 2012-04-22 |
Time limit: | 5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 SCM qobi |
hide comments
2016-01-11 17:35:28 Mitch Schwartz
@Dominique Thanks, I didn't see your comment until now. |
|
2015-09-04 11:22:19 Dominique VAILLANT
@Mitch: POLYGONA, INTER, CONTFRAC, TETRAHE1,... what a great firework in Ruby! |