Pagini recente » Cod sursa (job #370655) | Cod sursa (job #1103262) | Cod sursa (job #2228248) | Cod sursa (job #2326250) | Cod sursa (job #1759032)
#include <cstdio>
#include <iostream>
#define x first
#define y second
using namespace std;
const int nmx = 100002;
int n;
pair <double,double> v[nmx];
void citire()
{
scanf("%d", &n);
for(int i = 1; i <= n; ++i)
scanf("%lf %lf", &v[i].x, &v[i].y);
}
void calcul()
{
double t = 0;
for(int i = 1; i < n; ++i)
t += v[i].x * v[i+1].y - v[i+1].x * v[i].y;
t += v[n].x * v[1].y - v[1].x * v[n].y;
if(t < 0)
t = -t;
printf("%lf\n", t / 2);
}
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
citire();
calcul();
return 0;
}