Pagini recente » Cod sursa (job #3294405) | Cod sursa (job #2733553) | Cod sursa (job #3285400) | Cod sursa (job #3042117) | Cod sursa (job #3315882)
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
fopen("aria.in", "r");
FILE* out = fopen("aria.out", "w");
int n;
double ans = 0;
fscanf("%d", &n);
double x1, y1, xp, yp, x, y;
fscanf("%lf%lf", &x1, &y1);
xp = x1;
yp = y1;
for(int i = 1; i < n; i++) {
fscanf("%lf%lf", &x, &y);
ans += xp * y - x * yp;
xp = x;
yp = y;
}
ans += x * y1 - x1 * y;
ans /= 2;
fprintf(out, "%.5lf\n", ans);
return 0;
}