Pagini recente » Borderou de evaluare (job #2010450) | Cod sursa (job #3161402) | Cod sursa (job #2763562) | Borderou de evaluare (job #1567249) | Cod sursa (job #3279492)
#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) << (long double)abs(rez)/2.0;
}