Cod sursa(job #2878062)

Utilizator DooMeDCristian Alexutan DooMeD Data 25 martie 2022 19:14:01
Problema Aria Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#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;
}