Pagini recente » Cod sursa (job #2806557) | Cod sursa (job #1674286) | Cod sursa (job #214693) | Cod sursa (job #922470) | Cod sursa (job #2070159)
#include <fstream>
#include <iomanip>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
long double modul(long double val){
if(val < 0)
return -val;
return val;
}
int main()
{
int n;
long double sol = 0, xi, yi, xant, yant, x, y;
in>>n>>x>>y;
xi = xant = x;
yi = yant = y;
for(int i=2;i<=n;i++){
in>>x>>y;
sol += (xant * y - yant * x);
xant = x;
yant = y;
}
in.close();
sol += (x * yi - y * xi);
sol = modul(sol)/2;
out<<fixed<<setprecision(5)<<sol<<"\n";
out.close();
return 0;
}