Cod sursa(job #984958)

Utilizator Impaler_009Mihai Nitu Impaler_009 Data 15 august 2013 22:32:00
Problema Aria Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#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;
}