Pagini recente » Cod sursa (job #298042) | Cod sursa (job #2718485) | Cod sursa (job #1982155) | Cod sursa (job #2216413) | Cod sursa (job #1268728)
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int n;
long double arie;
struct punct{long double x; long double y;}a,b,p;
long double f(struct punct a, struct punct b)
{
return 0.5 * ((a.x)*(b.y) - (b.x)*(a.y));
}
int main()
{
freopen("aria.in","r",stdin);
freopen("aria.out","w",stdout);
scanf("%d",&n);
//scanf("%Lf %Lf",&a.x,&a.y);
cin>>a.x>>a.y;
p=a;
for(int i=2; i<=n; i++)
{
//scanf("%Lf %Lf",&b.x,&b.y);
cin>>b.x>>b.y;
arie+=f(a,b);
a=b;
}
arie+=f(a,p);
cout<<arie;
//printf("%Lf",arie);
return 0;
}