Pagini recente » Infoarena Monthly 2014 - Clasament | Cod sursa (job #1462522) | Cod sursa (job #2629742) | Cod sursa (job #2984109) | Cod sursa (job #1436267)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int modul( long double s)
{
return(max(s,-s));
}
int main()
{
long double x,y,xf = 0,yf = 0,n,i,xi,yi;
long double s = 0;
f >> n ;
f >> xi >> yi;
xf = xi;
yf = yi;
for( i = 2; i <= n; i++)
{
f >> x >> y;
s += xf*y - x*yf;
xf = x;
yf = y;
}
g << std::setprecision(5) << (s + x*yi - xi*y) / 2;
return 0;
}