Cod sursa(job #3365885)

Utilizator prodsevenStefan Albu prodseven Data 27 septembrie 2026 14:30:04
Problema Aria Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.57 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 << fabs(sum / 2.0);
    return 0;
}