Pagini recente » Borderou de evaluare (job #1559345) | Borderou de evaluare (job #2194018) | Borderou de evaluare (job #2630812) | Borderou de evaluare (job #159478) | Cod sursa (job #2878062)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Point {
long double x, y;
long double operator*(const Point &other) {
return x*other.y - other.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]);
long double area = 0;
for(int i=0; i<n; i++)
area += v[i]*v[i+1];
g << fixed << setprecision(5) << (long double)(area / 2.00);
return 0;
}