Pagini recente » Cod sursa (job #1578226) | Cod sursa (job #1197363) | Cod sursa (job #2805109) | Cod sursa (job #566380) | Cod sursa (job #2406813)
#include <bits/stdc++.h>
using namespace std;
ifstream inf("aria.in");
ofstream outf("aria.out");
int n;
double arie;
vector<pair<double,double>> pct;
int main()
{
inf>>n;
for(int i=1; i<=n; i++)
{
double x,y;
inf>>x>>y;
pct.push_back({x,y});
}
for(int i=0; i<n-1; i++)
arie+=(pct[i].first*pct[i+1].second-pct[i+1].first*pct[i].second)/2;
arie+=(pct[n-1].first*pct[0].second-pct[0].first*pct[n-1].second)/2;
outf<<setprecision(6)<<fixed;
outf<<arie;
return 0;
}