Cod sursa(job #3293949)

Utilizator andreidumitrache1709Dumitrache Andrei Bogdan andreidumitrache1709 Data 14 aprilie 2025 09:42:47
Problema Aria Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.55 kb
#include <bits/stdc++.h>
using namespace std;

int main() {
    ifstream cin( "aria.in" );
    ofstream cout( "aria.out" );
    int n , i;
    long long x , y , xc , yc , xf , yf;
    long double ans;
    ans = 0;
    cin >> n >> xc >> yc;
    xf = xc;
    yf = yc;
    for( i = 2 ; i <= n ; i++ ) {
        cin >> x >> y;
        ans += ( xc * y - x * yc ) / ( long double )2;
        xc = x;
        yc = y;
    }
    ans += ( x * yf - xf * y ) / ( long double )2;
    cout << setprecision( 5 ) << fixed << ans << '\n';
    return 0;
}