Pagini recente » Cod sursa (job #1651963) | Cod sursa (job #13492) | Cod sursa (job #228582) | Cod sursa (job #538115) | Cod sursa (job #1802332)
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
using namespace std;
struct point {
double x, y;
};
point points[100002];
double arie(point a, point b, point c) {
return (double)(a.x * b.y + b.x * c.y + a.y * c.x - a.x * c.y - a.y *b.x - c.x*b.y);
}
int main()
{
ifstream f("aria.in");
ofstream g("aria.out");
int n;
double aria = 0;
f >> n;
for (int i = 0; i < n; i++) {
f >> points[i].x >> points[i].y;
}
points[n]= points[0];
for (int i = 1; i < n; i++) {
aria += arie(points[0], points[i], points[i + 1]);
}
g << fixed << setprecision(5) << aria / 2;
return 0;
}