Cod sursa(job #2652912)

Utilizator bogdan_modoleaBogdan Modolea bogdan_modolea Data 26 septembrie 2020 13:50:23
Problema Aria Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.53 kb
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

string file="aria";

ifstream fin(file+".in");
ofstream fout(file+".out");

struct punct {
    int x, y;
}A, B, start;

int main()
{
    int n;
    ld arie = 0;
    fin >> n;
    fin >> A.x >> A.y;
    start = A;
    for(int i = 2; i <=n; i++){
        fin >> B.x >> B.y;
        arie += (A.x * B.y - A.y * B.x);
        A = B;
    }
    arie += (start.y * B.x - start.x * B.y);
    fout << fixed << setprecision (5) << arie / 2.0;
    return 0;
}