Cod sursa(job #2021675)

Utilizator VladUdriVlad Udrescu VladUdri Data 14 septembrie 2017 11:31:34
Problema Aria Scor 100
Compilator cpp Status done
Runda asdf1 Marime 0.5 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f("aria.in");
ofstream g("aria.out");

long double sum;
long double x_1, x_2, y_1, y_2;
int n;

int main()
{
    f >> n;
    f >> x_1 >> y_1;

    long double r_1, r_2;
    r_1 = x_1; r_2 = y_1;

    for(int i = 2; i <= n; ++i){
        f >> x_2 >> y_2;
        sum += (x_1 * y_2 - x_2 * y_1);

        x_1 = x_2; y_1 = y_2;
    }
    sum += (x_1 * r_2 - r_1 * y_1);
    sum /= 2;

    g << fixed << setprecision(5) << sum;
}