Mai intai trebuie sa te autentifici.
Cod sursa(job #2221713)
| Utilizator | Data | 15 iulie 2018 15:54:34 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <cstdio>
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
double x0, y0, x1, y1, x2 = 0, y2 = 0, area = 0;
int N; scanf("%d %lf %lf", &N, &x0, &y0);
x1 = x0; y1 = y0;
for(int i = 2; i <= N; ++i)
{
scanf("%lf %lf", &x2, &y2);
area += x1 * y2 - x2 * y1;
x1 = x2; y1 = y2;
}
area += x2 * y0 - x0 * y2;
printf("%.5Lf", (long double)area / 2);
return 0;
}
