Pagini recente » Cod sursa (job #2432231) | Cod sursa (job #2419648) | Cod sursa (job #3178706) | Cod sursa (job #2670589) | Cod sursa (job #1978461)
#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int main()
{
int N;
long 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 = fabs(s/2.0);
g << setprecision(6) << s;
return 0;
}