Pagini recente » Cod sursa (job #2123531) | Cod sursa (job #1431197) | Cod sursa (job #2058778) | Cod sursa (job #2355051) | Cod sursa (job #1369318)
#include <fstream>
#include <iomanip>
#define normalize 1000000
using namespace std;
double xs,ys,xc,yc,xa,ya,rez = 0;
int N;
int main()
{
ifstream fin("aria.in");
ofstream fout("aria.out");
fin >> N;
fin >> xs >> ys;
xs += normalize;
ys += normalize;
xa = xs;
ya = ys;
for(int i = 2; i <= N; ++i){
fin >> xc >> yc;
xc += normalize;
yc += normalize;
rez += (ya + yc)*(xa - xc);
xa = xc;
ya = yc;
}
rez += (ya + ys)*(xa - xs);
if(rez < 0)
rez *= -1;
fout << setprecision(6) << fixed;
fout << rez / 2;
return 0;
}