Pagini recente » Cod sursa (job #1094577) | Cod sursa (job #1477678) | Cod sursa (job #563032) | Cod sursa (job #2310548) | Cod sursa (job #1871266)
#include <iostream>
#include <cstdio>
using namespace std;
int n;
long double a;
double x1,y1,x2,y2,xa,ya;
long double arie()
{
return ((y1+y2)*(x2-x1))/2;
}
int main()
{
freopen("aria.in","r",stdin);
freopen("aria.out","w",stdout);
scanf("%d\n", &n);
scanf("%lf %lf", &x1, &y1);
xa=x1, ya=y1;
for(int i=1;i<n;i++)
{
scanf("%lf %lf", &x2, &y2);
a+=arie();
x1=x2, y1=y2;
}
x2=xa, y2=ya;
a+=arie();
if(a<0)
a*=(-1);
printf("%.5lf", a);
return 0;
}