Cod sursa(job #3278646)

Utilizator AlbertPavPavalache Albert AlbertPav Data 20 februarie 2025 13:02:32
Problema Aria Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.47 kb
#include <fstream>
#include <iomanip>
using namespace std;

struct Punct
{
    long double x, y;
};

Punct P, A, B;
int n;
long double Arie;

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

int main()
{
    f >> n;
    f >> P.x >> P.y;
    A = P;
    while(f >> B.x >> B.y)
    {
        Arie += A.x  * B.y - A.y * B.x;;
        A = B;
    }
    Arie += A.x * P.y - A.y * P.x;
    Arie /= 2;
    g << fixed << setprecision(6) << Arie;
    return 0;
}