Pagini recente » runda_ezoterica_3 | tema | Cod sursa (job #1198862) | Clasamentul arhivei de probleme | Cod sursa (job #1690510)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct pereche
{
int ox, oy;
};
pereche v[100001];
FILE *in, *out;
int main()
{
in=fopen("aria.in", "r");
out=fopen("aria.out", "w");
int N, x, y, i;
float A;
fscanf(in, "%d", &N);
for(i=1; i<=N; i++)
{
fscanf(in, "%d %d\n", &x, &y);
v[i].ox=x;
v[i].oy=y;
}
A=v[N].ox*v[1].oy-v[1].ox*v[N].oy;
for(i=1; i<=N-1; i++)
{
A=A+v[i].ox*v[i+1].oy-v[i+1].ox*v[i].oy;
}
A=A/2;
if(A<=0)
A=-A;
fprintf(out, "%0.5f", A);
fclose(in);
fclose(out);
return 0;
}