Pagini recente » Cod sursa (job #3211100) | Cod sursa (job #3200685) | Cod sursa (job #2075162) | Cod sursa (job #1627819) | Cod sursa (job #3226026)
#include <iostream>
#include <fstream>
#include <iomanip>
#define nl '\n'
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int main()
{
int N;
long double x1, y1, x2, y2, x3, y3, A = 0;
fin >> N >> x1 >> y1;
x2 = x1;
y2 = y1;
while (--N)
{
fin >> x3 >> y3;
A += x2*y3-x3*y2;
x2 = x3;
y2 = y3;
}
A += x2 * y1 - x1 * y2;
A/=2;
if (A < 0)
A = -A;
fout << fixed << setprecision(6) << A;
fin.close();
fout.close();
return 0;
}