Cod sursa(job #1584150)

Utilizator metrix007Lungu Ioan Adrian metrix007 Data 29 ianuarie 2016 18:57:26
Problema Aria Scor 10
Compilator cpp Status done
Runda Arhiva educationala Marime 0.48 kb
#include <iostream>
#include <fstream>
#include <algorithm>
#define NMAX 100002
using namespace std;

int n;
double arie;

struct punct
{
    double x,y;
}v[NMAX];

ifstream in("aria.in");
ofstream out("aria.out");

int main()
{
    in >> n;
    for(int i=1;i<=n;i++)
    {
        in >> v[i].x >> v[i].y;
    }
    v[n+1] = v[1];

    for(int i=1;i<=n;i++)
    {
        arie += (v[i].x*v[i+1].y-v[i+1].x*v[i].y);
    }

    out << arie/2;

    return 0;
}