Pagini recente » Cod sursa (job #613377) | Cod sursa (job #1070465) | Cod sursa (job #869275) | Cod sursa (job #2879351) | Cod sursa (job #1242447)
#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];
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;
}