Pagini recente » Cod sursa (job #1182073) | Cod sursa (job #2094279) | Cod sursa (job #1318893) | Cod sursa (job #2522745) | Cod sursa (job #1023816)
#include<stdio.h>
#include<iostream>
using namespace std;
double x[2],y[2],a,b,S;
int N;
int main()
{
freopen("aria.in","r",stdin);
freopen("aria.out","w",stdout);
scanf("%d",&N);
for(int i=1;i<=N;++i)
{
scanf("%lf%lf",&x[0],&y[0]);
if(i==1)
{
a = x[0];
b = y[0];
}
else
{
S = S + x[1]*y[0] - x[0]*y[1];
}
x[1] = x[0];
y[1] = y[0];
}
S = S + b*x[1] - a*y[1];
if(S<0)
printf("%lf",-S/2);
else
printf("%lf",S/2);
return 0;
}