Cod sursa(job #1794240)
| Utilizator | Data | 1 noiembrie 2016 08:52:07 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <stdio.h>
#include <math.h>
struct point{
double x,y;
};
int main(){
freopen("aria.in","r",stdin);
unsigned long n;
point a,b,c;
scanf("%lu",&n);
scanf("%lf %lf",&a.x,&a.y);
c=a;
double surface=0;
for(unsigned long i=1;i<n;i++){
scanf("%lf %lf",&b.x,&b.y);
surface+=a.x*b.y-b.x*a.y;
a.x=b.x;
a.y=b.y;
}
fclose(stdin);
b=c;
surface+=a.x*b.y-b.x*a.y;
freopen("aria.out","w",stdout);
printf("%.5lf",fabs(surface/2.0));
fclose(stdout);
return 0;
}
