Pagini recente » Cod sursa (job #3167569) | Cod sursa (job #2193103) | Cod sursa (job #2355720) | Cod sursa (job #1157726) | Cod sursa (job #2195640)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
vector<pair<long double,long double> >points;
int n;
long double x,y,thepoint_x,thepoint_y;
long double calc(int point)
{
return points[point].first*points[point+1].second-points[point].second*points[point+1].first;
}
int main()
{
fin>>n;
for(int i=0;i<n;i++)
{
fin>>x>>y;
points.push_back({x,y});
}
long double arie=0;
for(int i=0;i<n-1;i++)
arie+=calc(i);
arie+=points[n-1].first*points[0].second-points[n-1].second*points[0].first;
fout<<arie/2.0;
return 0;
}