Cod sursa(job #1027742)
Utilizator | Timofte Bogdan kitz | Data | 12 noiembrie 2013 23:46:53 |
---|---|---|---|
Problema | Aria | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.54 kb |
# include <cstdio>
# include <cmath>
const char *FIN = "aria.txt", *FOU = "aria.out";
const int MAX = 100005;
struct punct {
double x, y;
} vec[MAX];
int N;
double sol;
int main (void) {
freopen (FIN, "r", stdin);
freopen (FOU, "w", stdout);
scanf ("%d", &N);
for (int i = 0; i < N; ++i)
scanf ("%lf %lf", &vec[i].x, &vec[i].y);
vec[N] = vec[0];
for (int i = 0; i < N; ++i)
sol += (vec[i].x * vec[i + 1].y - vec[i + 1].x * vec[i].y);
printf ("%lf", fabs (sol / 2.0));
}