Pagini recente » Cod sursa (job #514995) | Cod sursa (job #2343191) | Cod sursa (job #1814122) | Cod sursa (job #3245750) | Cod sursa (job #2878060)
#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 << (long double)(area / 2.00);
return 0;
}