Cod sursa(job #1974083)

Utilizator TataruTataru Mihai Tataru Data 26 aprilie 2017 19:18:52
Problema Aria Scor 90
Compilator cpp Status done
Runda Arhiva educationala Marime 0.49 kb
#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;

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

int main()
{
    long double a = 0;
    double x1, x2, x3, y1, y2, y3;
    int N;
    fin>>N;
    fin>>x1>>y1>>x2>>y2;
    for(int i = 3; i <= N; i++)
    {
        fin>>x3>>y3;
        a += x1 * y2 + x2 * y3 + y1 * x3 - x3 * y2 - x1 * y3 - x2 * y1;
        x2 = x3, y2 = y3;
    }
    fout<<fixed<<setprecision(5)<<a * 0.5;
    return 0;
}