Cod sursa(job #3242011)
| Utilizator | Data | 7 septembrie 2024 12:26:26 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5;
struct point {
double x, y;
}A[MAX + 3];
int N;
long double ans;
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[N + 1] = A[1];
for(int i = 1; i <= N; i++) {
ans += A[i].x * A[i + 1].y - A[i + 1].x * A[i].y;
}
ans /= 2;
cout << setprecision(5) << fixed;
cout << ans;
}