Cod sursa(job #2364121)
| Utilizator | Data | 3 martie 2019 21:11:48 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
const int MAX_N = 100000;
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int n;
long double x[MAX_N + 5], y[MAX_N + 5];
long double s;
int main() {
fin >> n;
for(int i = 1; i <= n; i++)
fin >> x[i] >> y[i];
x[n + 1] = x[1];
y[n + 1] = y[1];
for(int i = 1; i <= n; i++)
s += (x[i] * y[i + 1] - y[i] * x[i + 1]);
if(s < 0)
s *= -1;
fout << fixed << setprecision(6) << s/2 << '\n';
return 0;
}
