Cod sursa(job #3365888)

Utilizator prodsevenStefan Albu prodseven Data 27 septembrie 2026 14:32:28
Problema Aria Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.62 kb
#include <fstream>
#include <cmath>
#include <iomanip>
#include <vector>

using namespace std;

ifstream cin("aria.in");
ofstream cout("aria.out");

struct Point {
    double x, y;
};

int n;
vector<Point> points;

int main() {
    cin >> n;
    for (int i = 0 ; i < n ; ++i) {
        double x, y;
        cin >> x >> y;
        points.push_back({x, y});
    }
    long double sum = 0;
    points.push_back(points[0]);
    for (int i = 0 ; i < n ; ++i) {
        sum += (points[i].x * points[i + 1].y - points[i + 1].x * points[i].y);
    }
    cout << fixed << setprecision(6) << 1.0 * floor(fabs(sum) * 0.5 * 1e6) / 1e6;
    return 0;
}