Pagini recente » Cod sursa (job #377436) | Cod sursa (job #2144028) | Cod sursa (job #2507956) | Cod sursa (job #2564034) | Cod sursa (job #2426480)
#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>
using namespace std;
ifstream f("arie.in");
ofstream g("arie.out");
int main()
{
int n, x1, y1, x2, y2, xp, yp;
long double s = 0;
xp = x1;
yp = y1;
for(int i = 2; i <= n; i++)
{
f >> x2 >> y2;
s += x1 * y2 - x2 * y1;
x1 = x2;
y1 = y2;
}
s += x2 * yp - y2 * xp;
s /= 2;
g << fixed << setprecision(5) << s;
return 0;
}