Cod sursa(job #1962267)

Utilizator tothalToth Alexandru tothal Data 11 aprilie 2017 17:52:05
Problema Aria Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.46 kb
#include <fstream>
#include <iomanip>

using namespace std;

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

int main()
{
    int n, x[100005], y[100005];
    float A = 0;
    fin >> n;

    for( int i = 0; i < n; i++)
    {
        fin >> x[i] >> y[i];
    }
    x[n] = x[0];
    y[n] = y[0];
    for( int i = 0; i <= n; i++)
    {
        A += (x[i]*y[i+1] - x[i+1]*y[i]);
    }
    A/=2;
    fout <<fixed << setprecision(6) << A;
}