Cod sursa(job #1404463)

Utilizator razboi4Manole Iulian razboi4 Data 28 martie 2015 11:35:11
Problema Aria Scor 50
Compilator cpp Status done
Runda Arhiva educationala Marime 0.62 kb
#include<bits/stdc++.h>

#define Nmax 100005
#define X first
#define Y second

using namespace std;

pair < double , double > Point[Nmax];
int N;

void Read()
{
    freopen("aria.in", "r", stdin);
    scanf("%d", &N);
    for(int i = 1; i <= N; ++ i)
        scanf("%lf %lf", &Point[i].X, &Point[i].Y);
    Point[N + 1] = Point[1];
}

double Arie()
{
    double Aria = 0;
    for(int i = 1; i <=N; ++ i)
        Aria += Point[i].X * Point[i + 1].Y - Point[i + 1].X * Point[i].Y;
    return Aria;
}

int main()
{
    Read();
    fprintf(fopen("aria.out", "w"), "%.0lf", Arie() * 0.5);
    return 0;
}