Cod sursa(job #2874958)
| Utilizator | Data | 20 martie 2022 15:57:32 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <fstream>
using namespace std;
ifstream cin("aria.in");
ofstream cout("aria.out");
class point {
public:
long double x, y;
long double operator*(point a) {
return x * a.y - y * a.x;
}
};
int n;
point v[100002];
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> v[i].x >> v[i].y;
}
v[n] = v[0];
long double ans = 0;
for (int i = 0; i < n; i++) {
ans += (v[i].x * v[i + 1].y-v[i].y*v[i+1].x) / 2.0;
}
cout << ans;
}