Cod sursa(job #2432431)
| Utilizator | Data | 23 iunie 2019 17:20:07 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
const int DIM = 1e5 + 7;
int x[DIM];
int y[DIM];
int main()
{
int n;
in >> n;
for(int i = 1; i <= n; i++)
in >> x[i] >> y[i];
x[n + 1] = x[1];
y[n + 1] = y[1];
long long ans = 0;
for(int i = 1; i <= n + 1; i++)
ans += x[i] * y[i + 1] - x[i + 1] * y[i];
ans = abs(ans);
out << ans / 2;
if(ans & 1)
out << ".5";
}
