Mai intai trebuie sa te autentifici.
Cod sursa(job #2342898)
| Utilizator | Data | 13 februarie 2019 15:14:39 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
struct Punct{
long double x;
long double y;
}v [100003];
int n;
long double ans;
int main (){
fin >> n;
for (int i = 1; i <= n; i ++)
fin >> v [i].x >> v [i].y;
v [n + 1].x = v [1].x;
v [n + 1].y = v [1].y;
for (int i = 1; i <= n; i ++)
ans += v [i].x * v [i + 1].y - v [i + 1].x * v [i].y;
if (ans < 0)ans = -ans;
fout << fixed << setprecision (5) << ans / 2;
return 0;
}
