Cod sursa(job #3289328)

Utilizator Roberthinio7Robert Dragan Roberthinio7 Data 26 martie 2025 15:49:57
Problema Aria Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.77 kb
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
using namespace std;
#define int long double
signed main()
{
    ifstream cin("aria.in");
    ofstream cout("aria.out");
    int n,a,b,x,y,aa,bb,ans=0;
    cin >> n >> a >> b;
    aa=a;bb=b;
    for(int i=1;i<n;i++){
        cin >> x >> y;
        ans+=a*y-x*b;
        a=x;
        b=y;
    }
    ans+=bb*-aa*y;
    ans/=2;
    ans=abs(ans);
    cout << fixed << setprecision(5)<< ans;
    return 0;
}