Cod sursa(job #2067733)

Utilizator flaviu_2001Craciun Ioan-Flaviu flaviu_2001 Data 16 noiembrie 2017 19:55:41
Problema Aria Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <bits/stdc++.h>

using namespace std;

double sol, a, b, x, y, a1, b1;
int n;

int main()
{
    ifstream fin ("aria.in");
    ofstream fout ("aria.out");
    fin >> n >> x >> y;--n;
    a1 = x; b1 = y;
    while(n--){
        a = x; b = y;
        fin >> x >> y;
        sol += (a*y-b*x);
    }
    sol += (x*b1-a1*y);
    fout << fixed << setprecision(10) << abs(sol/2.0) << "\n";
    fin.close();
    fout.close();
    return 0;
}