Pagini recente » Cod sursa (job #977983) | Cod sursa (job #797242) | Cod sursa (job #1777407) | Cod sursa (job #1779895) | Cod sursa (job #2863964)
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct puncte
{
long double x, y;
}p[100005];
int n;
void citire()
{
fin>>n;
for(int i=0; i<n; i++)
fin>>p[i].x>>p[i].y;
}
long double arie()
{
long double a=0;
for(int i=0; i<n-1; i++)
a+=(p[i].x*p[i+1].y-p[i+1].x*p[i].y)/2;
return a+(p[n-1].x*p[0].y-p[0].x*p[n-1].y)/2;
}
int main()
{
citire();
fout<<setprecision(5)<<fixed<<abs(arie());
return 0;
}