Cod sursa(job #2647113)

Utilizator chriss_b_001Cristian Benghe chriss_b_001 Data 3 septembrie 2020 11:28:48
Problema Aria Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.43 kb
#include <fstream>

using namespace std;

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

int N;

struct Punct
{
    long double x, y;
};

Punct v[100001];

int main()
{
    f >> N;
    for(int i = 0; i < N; ++i)
        f >> v[i].x >> v[i].y;
    v[N] = v[0];
    long double ans = 0;
    for(int i = 0; i < N; ++i)
        ans += (v[i].x * v[i + 1].y - v[i + 1].x * v[i].y);
    g << ans / 2;
    return 0;
}