Pagini recente » Cod sursa (job #644195) | Cod sursa (job #629453) | Cod sursa (job #55999) | Cod sursa (job #2652951) | Cod sursa (job #1404680)
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
double x, y, x1, y1, newX, newY, S;
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
scanf("%d\n", &n);
scanf("%lf %lf\n", &x, &y);
x1 = x;
y1 = y;
for (int i = 2; i <= n; ++i){
scanf("%lf %lf\n", &newX, &newY);
S = S + x * newY - newX * y;
x = newX;
y = newY;
}
S = S + newX * y1 - x1 * newY;
printf("%.5lf\n", S/2);
return 0;
}