Cod sursa(job #2303309)

Utilizator andreisontea01Andrei Sontea andreisontea01 Data 15 decembrie 2018 23:29:55
Problema Aria Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.54 kb
#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second

pair<long double, long double> pct[100005];

int main()
{
    ifstream fin("aria.in");
    ofstream fout("aria.out");
    int n;
    fin >> n;
    long double arie = 0.00000;
    for(int i = 1; i <= n; ++i)
        fin >> pct[i].x >> pct[i].y;
    pct[n + 1] = pct[1];
    for(int i = 1; i <= n; ++i)
        arie += pct[i].x * pct[i + 1].y - pct[i + 1].x * pct[i].y;
    arie /= 2;
    fout << fixed << setprecision(6) << arie;
    return 0;


}