Pagini recente » Cod sursa (job #2876735) | Cod sursa (job #1085557) | Cod sursa (job #533697) | Cod sursa (job #1019837) | Cod sursa (job #1404701)
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
long double x, y, xprim, yprim, 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);
xprim = x;
yprim = 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 * yprim - xprim * newY;
printf("%.5Lf\n", S/2);
return 0;
}