Cod sursa(job #2763739)

Utilizator levladiatorDragutoiu Vlad-Ioan levladiator Data 16 iulie 2021 15:29:40
Problema Aria Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.48 kb
#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

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

int main()
{
    int N;
    double x1, y1, x2, y2, x3, y3;
    long double A = 0;
    f >> N >> x1 >> y1;
    x2 = x1;
    y2 = y1;
    while(--N)
    {
        f >> x3 >> y3;
        A += x2 * y3 - x3 * y2;
        x2 = x3;
        y2 = y3;
    }
    A += x2 * y1 - x1 * y2;
    A /= 2;
    g <<  fixed << setprecision(5) << abs(A);
    return 0;
}