Pagini recente » Cod sursa (job #3000541) | Cod sursa (job #3291843) | Cod sursa (job #2256890) | Cod sursa (job #2082641) | Cod sursa (job #1242449)
#include <cstdio>
#include <cstdlib>
#include <utility>
using namespace std;
int n;
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
pair<double, double> start, points[2];
long double sol = 0;
scanf("%d", &n);//cin >> n;
scanf("%lf %lf", &start.first, &start.second);//cin >> start.first >> start.second;
points[1] = start;
for (int i=1; i<n; ++i){
points[0] = points[1];
scanf("%lf %lf", &points[1].first, &points[1].second);//cin >> points[1].first >> points[1].second;
sol += points[0].first*points[1].second-points[1].first*points[0].second;
}
sol += points[1].first*start.second-points[1].second*start.first;
printf("%.6Lf", (sol>0 ? sol/2 : -sol/2));//cout << fixed << setprecision(5) << (sol>0 ? sol/2 : -sol/2);
return 0;
}