Pagini recente » Cod sursa (job #3365880) | Cod sursa (job #3364984) | Cod sursa (job #3365115) | Profil LittleGreenMen | Cod sursa (job #3365890)
#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 << fixed << setprecision(5) << 1.0 * fabs(sum) * 0.5;
return 0;
}