Pagini recente » Cod sursa (job #1120662) | Cod sursa (job #2655016) | Cod sursa (job #2913850) | Cod sursa (job #1440762) | Cod sursa (job #1013477)
#include<stdio.h>
#include<math.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+=(x[i]*y[i+1])-(x[i+1]*y[i]);
a=abs(a);
a/=2;
fprintf(fo,"%lf",a);
fclose(fi); fclose(fo);
return 0;
}