Cod sursa(job #1980722)
| Utilizator | Data | 13 mai 2017 21:40:18 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <bits/stdc++.h>
using namespace std;
struct Coord
{
double x, y;
} v[100005];
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
int n;
scanf("%d", &n);
for(int i = 0; i < n; i++)
scanf("%lf%lf", &v[i].x, &v[i].y);
double rez = 0;
v[n] = v[0];
for(int i = 0; i < n; i++)
rez += v[i].x * v[i + 1].y - v[i].y * v[i + 1].x;
rez /= 2.;
printf("%f", rez);
return 0;
}
