Pagini recente » Cod sursa (job #676780) | Cod sursa (job #2679895) | Cod sursa (job #2281628) | Cod sursa (job #2435060) | Cod sursa (job #1120051)
#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';
}