Pagini recente » Cod sursa (job #283106) | Cod sursa (job #1700063) | Cod sursa (job #296125) | Cod sursa (job #2905772) | Cod sursa (job #2084719)
#include <iostream>
#include <cstdio>
#define x first
#define y second
using namespace std;
const int NMax = 100002 ;
int N;
pair < double, double > v[NMax];
void Read()
{
scanf("%d", &N);
for(int i=1; i<=N; ++i)
scanf("%lf %lf", &v[i].x, &v[i].y);
}
double Solve()
{
double rez = 0;
for(int i=1; i<N; ++i)
rez += v[i].x*v[i+1].y - v[i+1].x*v[i].y;
rez+=v[N].x*v[1].y-v[1].x*v[N].y;
if( rez < 0)
rez = -rez;
return rez;
}
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
Read();
printf("%lf\n", Solve()/2);
return 0;
}