Cod sursa(job #1819823)
Utilizator | Data | 30 noiembrie 2016 20:56:43 | |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.25 kb |
#include <fstream>
main(){std::ifstream f ("aria.in");freopen("aria.out","w",stdout);
int n;long double p=0;double a,b,c,d;
f>>n>>a>>b;c=a,d=b;
for(int i=1;i<n;++i){double x,y;f>>x>>y,p+=x*b-y*a,a=x,b=y;}
p+=c*b-d*a;p=(p<0?-p:p);
printf("%.5Lf",p/2);}