Cod sursa(job #2221610)
| Utilizator | Data | 14 iulie 2018 23:10:35 | |
|---|---|---|---|
| Problema | Aria | Scor | 80 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
long double x0, y0, x1, y1, x2 = 0, y2 = 0, area = 0;
int N; cin >> N >> x0 >> y0;
x1 = x0; y1 = y0;
while(--N)
{
cin >> x2 >> y2;
area += x1 * y2 - x2 * y1;
x1 = x2; y1 = y2;
}
area += x1 * y0 - x0 * y1;
cout << setprecision(5) << fixed << area / 2.0;
return 0;
}
