Pagini recente » Cod sursa (job #2166865) | Cod sursa (job #699685) | Cod sursa (job #1157164) | Cod sursa (job #144215) | Cod sursa (job #2670115)
#include <bits/stdc++.h>
using namespace std;
pair <double,double> coord[100005];
ifstream fin("aria.in");
ofstream fout("aria.out");
int main() {
int n;
long double arie = 0;
fin >> n;
for(int i = 1;i <= n; ++i)
fin >> coord[i].first >> coord[i].second;
for(int i = 1;i < n; ++i)
arie += coord[i].first * coord[i+1].second - coord[i+1].first * coord[i].second;
arie += coord[n].first * coord[1].second - coord[1].first * coord[n].second;
fout << setprecision(5) << fixed << arie / 2;
return 0;
}