Cod sursa(job #2067731)

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

using namespace std;

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

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