Pagini recente » Cod sursa (job #2718427) | Cod sursa (job #1930315) | Cod sursa (job #612035) | Cod sursa (job #1881924) | Cod sursa (job #2231773)
#include<iomanip>
#include<fstream>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
ifstream in("aria.in");
ofstream out("aria.out");
int n;
long double xPrev, yPrev, x, y, xF, yF, sol=0;
in>>n>>xPrev>>yPrev;
xF=xPrev; yF=yPrev;
for(int i=1;i<=n-1;i++){
in>>x>>y;
sol+=(xPrev*y-x*yPrev);
xPrev=x; yPrev=y;
}
sol+=(xPrev*yF-xF*yPrev);
sol=sol/2.0;
out<<fixed<<setprecision(5)<<fabs(sol);
in.close(); out.close();
return 0;
}