Pagini recente » Cod sursa (job #283991) | Cod sursa (job #2832240) | Cod sursa (job #1164010) | Cod sursa (job #292451) | Cod sursa (job #2929939)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
struct pct
{
long double x;
long double y;
}a[100005];
int n;
void cit()
{
f>>n;
for(int i=0;i<n;i++)
f>>a[i].x>>a[i].y;
}
int det(pct A, pct B)
{
int nr=A.x*B.y-A.y*B.x;
return nr;
}
int modul(int x)
{
if(x<0)
return ((-1)*x);
return x;
}
long double supr()
{
long double s=0;
for(int i=0;i<n-1;i++)
s+=0.5*det(a[i],a[i+1]);
s+=0.5*det(a[n-1],a[0]);
return modul(s);
}
void afis()
{
g<<fixed<<setprecision(5)<<supr();
}
int main()
{
cit();
afis();
return 0;
}