Cod sursa(job #2878059)
| Utilizator | Data | 25 martie 2022 19:10:35 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Point {
double x, y;
};
double Product(Point a, Point b) {
return a.x * b.y - b.x * a.y;
}
int main () {
ifstream f("aria.in");
ofstream g("aria.out");
int n; f >> n;
vector<Point> v(n);
for(int i=0; i<n; i++) f >> v[i].x >> v[i].y;
v.emplace_back(v[0]);
double area = 0;
for(int i=0; i<n; i++)
area += 1LL * Product(v[i], v[i+1]);
g << double(area / 2.00);
return 0;
}
