Pagini recente » Cod sursa (job #1460600) | Cod sursa (job #1649736) | Cod sursa (job #3122620) | Cod sursa (job #2749588) | Cod sursa (job #1978462)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int main()
{
long double s = 0;
double x1, x2, y1, y2;
int N;
f >> N;
f >> x1 >> y1;
double x = x1, y = y1;
for(int i = 2; i <= N; i++)
{
f >> x2 >> y2;
s += x1 * y2 - x2 * y1;
x1 = x2, y1 = y2;
}
s += x1 * y - x * y1;
g << fixed << setprecision(5) << s / 2;
return 0;
}