Pagini recente » Cod sursa (job #173302) | Cod sursa (job #2912182) | Cod sursa (job #2149784) | Cod sursa (job #2463314) | Cod sursa (job #2190909)
#include <cstdio>
#include <cmath>
using namespace std;
int n;
double sol;
struct xy_coordinates {
double x, y;
} pos[100005];
int main()
{
FILE *in, *out;
in = freopen("aria.in", "r", stdin);
out = freopen("aria.out", "w", stdout);
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%lf%lf", &pos[i].x, &pos[i].y);
fclose(in);
for (int i = 1; i < n; i++) sol += (pos[i].x * pos[i + 1].y - pos[i + 1].x * pos[i].y);
sol += (pos[n].x * pos[1].y - pos[1].x * pos[n].y);
sol = abs(sol / 2);
printf("%.5lf", sol);
fclose(out);
return 0;
}