Cod sursa(job #1120051)
| Utilizator | Data | 24 februarie 2014 21:20:28 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.42 kb |
#include <fstream>
#include <iomanip>
#include <cmath>
int main(){
std::ifstream fin("aria.in");
std::ofstream fout("aria.out");
unsigned n; fin>>n;
long double A=0;
if(n>2){
long double x0,y0,xp,yp;
fin>>xp>>yp;
x0=xp; y0=yp;
long double x,y;
for(unsigned i=1;i<n;++i){
fin>>x>>y;
A+=xp*y-x*yp;
xp=x; yp=y;
}
A+=xp*y0-x0*yp;
}
fout<<std::fixed<<std::setprecision(5)<<0.5*std::abs(A)<<'\n';
}
