Pagini recente » Cod sursa (job #2877836) | Cod sursa (job #2368007) | Cod sursa (job #2683551) | Cod sursa (job #1942880) | Cod sursa (job #1023819)
#include<stdio.h>
#include<iostream>
using namespace std;
double x[2],y[2],a,b;
long double S=0;
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)
cout<<-S/2;
else
cout<<S/2;
return 0;
}