Pagini recente » Cod sursa (job #2923055) | Cod sursa (job #468373) | Cod sursa (job #639623) | Cod sursa (job #1161417) | Cod sursa (job #2406810)
#include <bits/stdc++.h>
using namespace std;
ifstream inf("aria.in");
ofstream outf("aria.out");
int n;
float arie;
vector<pair<int,int>> pct;
int main()
{
inf>>n;
for(int i=1; i<=n; i++)
{
int x,y;
inf>>x>>y;
pct.push_back({x,y});
}
for(int i=0; i<n-1; i++)
arie+=1.0*(pct[i].first*pct[i+1].second-pct[i+1].first*pct[i].second)/2;
arie+=1.0*(pct[n-1].first*pct[0].second-pct[0].first*pct[n-1].second)/2;
outf<<setprecision(5)<<fixed;
outf<<arie;
return 0;
}