Pagini recente » Cod sursa (job #1013460) | Cod sursa (job #1211128) | Cod sursa (job #1275488) | Cod sursa (job #2851356) | Cod sursa (job #1013487)
#include<stdio.h>
#define maxn 100005
FILE *fi,*fo;
int i,n;
double x[maxn],y[maxn];
double a=0;
int main(void){
fi=fopen("aria.in","r");
fo=fopen("aria.out","w");
fscanf(fi,"%d",&n);
for(i=1;i<=n;i++) fscanf(fi,"%lf%lf",&x[i],&y[i]);
x[n+1]=x[1]; y[n+1]=y[1];
for(i=1;i<=n;i++) a+=(1LL*x[i]*y[i+1])-(1LL*x[i+1]*y[i]);
if (a<0) a=-a;
a/=2;
fprintf(fo,"%lf",a);
fclose(fi); fclose(fo);
return 0;
}