Pagini recente » Cod sursa (job #349044) | Cod sursa (job #2084275) | Cod sursa (job #439031) | Cod sursa (job #349034) | Cod sursa (job #1978459)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int main()
{
int N;
double x0,x1,x2,y0,y1,y2,s=0;
f >> N;
f >> x0 >> y0;
x1=x0;
y1=y0;
s = 0;
for (int i=2; i<=N; i++)
{
f >> x2 >> y2;
s += x1 * y2 - x2 * y1;
x1 = x2;
y1 = y2;
}
s += x2*y0 - x0*y2;
s /= 2;
g << setprecision(5) << s;
return 0;
}