Pagini recente » Cod sursa (job #2033152) | Cod sursa (job #163748) | Cod sursa (job #2285027) | Cod sursa (job #2621387) | Cod sursa (job #1876018)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
double x0, y0, x1, y1, x2, y2, s = 0;
freopen("aria.in", "rt", stdin);
freopen("aria.out", "wt", stdout);
scanf("%d", &n);
scanf("%lf%lf", &x0, &y0);
x2 = x0; y2 = y0;
for (int i = 1; i < n; ++i) {
x1 = x2; y1 = y2;
scanf("%lf%lf", &x2, &y2);
s += x2 * y1 - x1 * y2;
}
s += x0 * y2 - x2 * y0;
if (s < 0) s = -s;
s /= 2;
printf("%.5lf\n", s);
return 0;
}