Pagini recente » Cod sursa (job #2728707) | Cod sursa (job #2557357) | Cod sursa (job #3146413) | Cod sursa (job #3254916) | Cod sursa (job #2299370)
#include<bits/stdc++.h>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
void print(long double x)
{
x*=100000;
x=floor(x);
x/=100000;
fout<<x;
/*int n=x;
if(n==x)
cout<<".0";*/
return;
}
struct point{
long double x;
long double y;
};
long double area(point a,point b,point c)
{
a.x-=c.x;
a.y-=c.y;
b.x-=c.x;
b.y-=c.y;
return ((a.x*b.y)-(a.y*b.x))/2;
}
long double full_area(int n,point* v)
{
long double sup=0;
for(int i=2;i<n;i++)
{
sup+=area(v[1],v[i],v[i+1]);
//cout<<sup<<'\n';
}
return abs(sup);
}
int main()
{
point v[100001];
int n,i;
fin>>n;
for(i=1;i<=n;i++)
fin>>v[i].y>>v[i].x;
long double x=full_area(n,v);
print(x);
return 0;
}