Pagini recente » Cod sursa (job #1962569) | Cod sursa (job #114530) | Istoria paginii utilizator/lolopolo | Cod sursa (job #248645) | Cod sursa (job #984958)
Cod sursa(job #984958)
#include <fstream>
#include <iomanip>
#define maxn 100001
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
int n;
struct point
{
double x,y;
}v[maxn];
inline double det_origin (const point &a, const point &b)
{
return a.x*b.y - a.y*b.x;
}
int main()
{
double A=0;
fin>>n;
for (int i=1; i<=n; ++i) fin>>v[i].x>>v[i].y;
for (int i=1; i<n; ++i) A += det_origin (v[i],v[i+1]);
A += det_origin (v[n],v[1]);
fout<<fixed<<A/2;
}