Cod sursa(job #2869338)
| Utilizator | Data | 11 martie 2022 14:17:45 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <iostream>
#include <iomanip>
#define NMAX 100005
using namespace std;
typedef long double ld;
struct elem {
ld x, y;
} a[NMAX];
int n;
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
cin >> n;
for(int i = 1; i <= n; ++i)
cin >> a[i].x >> a[i].y;
a[0] = a[n];
ld ans = 0;
for(int i = 1; i <= n; ++i)
ans += a[i - 1].x * a[i].y - a[i].x * a[i - 1].y;
ans /= 2.;
cout << fixed << setprecision(8) << (ans > 0 ? ans : -ans);
return 0;
}
