Cod sursa(job #1404684)
| Utilizator | Data | 28 martie 2015 14:16:07 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
double x, y, xprim, yprim, newX, newY, S;
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
scanf("%d\n", &n);
scanf("%lf %lf\n", &x, &y);
xprim = x;
yprim = y;
for (int i = 2; i <= n; ++i){
scanf("%lf %lf\n", &newX, &newY);
S = S + x * newY - newX * y;
x = newX;
y = newY;
}
S = S + newX * yprim - xprim * newY;
printf("%.5lf\n", S/2);
return 0;
}
