Cod sursa(job #3339068)

Utilizator rares89_Dumitriu Rares rares89_ Data 5 februarie 2026 23:03:47
Problema Aria Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.53 kb
#include <fstream>
#include <iostream>
#include <iomanip>

using namespace std;

ifstream fin("aria.in");
ofstream fout("aria.out");

int main() {
    int n;
    double ans = 0, x, y, a, b;
    
    fin >> n;
    fin >> x >> y;
    double xx = x, yy = y;
    for(; n > 1; --n) {
        fin >> a >> b;
        ans += (x * b - a * y); 
        x = a;
        y = b;
    }
    fin.close();
    
    ans += (x * yy - xx * y);
    ans *= 0.5;
    fout << fixed << setprecision(5) << ans;
    fout << "\n";
    return 0;
}