Pagini recente » Cod sursa (job #1475741) | Cod sursa (job #2212188) | Cod sursa (job #1010731) | Cod sursa (job #2838580) | Cod sursa (job #1294338)
#include <cstdio>
using namespace std;
const int nmax = 100000;
struct point
{
double x, y;
};
point a[nmax+5];
double ccw(point a, point b, point c)
{
double cp = (b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x);
return cp/2;
}
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
int n;
scanf("%d", &n);
for(int i=0; i<n; i++)
{
double x, y;
scanf("%lf%lf", &x, &y);
a[i].x = x; a[i].y = y;
}
double A = 0;
for(int i=1; i<n-1; i++)
{
A+=ccw(a[0], a[i], a[i+1]);
}
printf("%.5lf", A);
return 0;
}