Pagini recente » Borderou de evaluare (job #1557712) | Borderou de evaluare (job #271937) | Cod sursa (job #3000104) | Cod sursa (job #2384903) | Cod sursa (job #3279493)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
const int nmax=1e5+5;
pair <long double,long double> v[nmax];
long double det2 (long double x1, long double y1, long double x2, long double y2)
{
return x1*y2-y1*x2;
}
signed main()
{
int n;
fin >> n;
for (int i=1; i<=n; i++)
fin >> v[i].first >> v[i].second;
v[0]=v[n];
long double rez=0;
for (int i=1; i<=n; i++)
rez+=det2(v[i].first,v[i].second,v[i-1].first,v[i-1].second);
fout << fixed << setprecision(5) << abs(rez)/2.0;
}