Pagini recente » Cod sursa (job #2986105) | Cod sursa (job #3141429) | Cod sursa (job #2588037) | Cod sursa (job #2641890) | Cod sursa (job #2300082)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
long long int n,i;
double a,s;
struct punct{
double x,y;
}v[100001],p;
int c_p(punct a, punct o, punct b)
{
int d=( a.x - o.x ) * ( b.y - o.y ) - ( b.x - o.y) * ( a.y - o.y );
return d;
}
int main()
{
fin>>n;
for(i=1;i<=n;i++)
{
fin>>v[i].x>>v[i].y;
}
p.x=0;
p.y=0;
for(i=1;i<n;i++)
{
a=c_p(v[i],p,v[i+1])/2;
s=s+a;
}
a=c_p(v[n],p,v[1])/2;
s=s+a;
fout<<s;
return 0;
}