Pagini recente » Cod sursa (job #3229276) | Diferente pentru problema/3secv intre reviziile 14 si 5 | Cod sursa (job #473534) | Cod sursa (job #3342959) | Cod sursa (job #3316665)
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE* in = fopen("aria.in", "r");
FILE* out = fopen("aria.out", "w");
int n;
float ans = 0;
fscanf(in, "%d", &n);
float x1, y1, xp, yp, x, y;
fscanf(in, "%f%f", &x1, &y1);
xp = x1;
yp = y1;
for(int i = 1; i < n; i++) {
fscanf(in, "%f%f", &x, &y);
ans += xp * y - x * yp;
xp = x;
yp = y;
}
ans += x * y1 - x1 * y;
ans /= 2;
fprintf(out, "%.5ff\n", ans);
return 0;
}