Cod sursa(job #970006)
Utilizator | Data | 5 iulie 2013 20:43:23 | |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <cstdio>
#include <cmath>
struct Point
{
double x, y;
};
int main(void)
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
int nV;
scanf("%d", &nV);
Point *ptrP(new Point[nV + 1]);
for(int i(0); i < nV; i++)
scanf("%lf %lf", &ptrP[i].x, &ptrP[i].y);
double dAns(0.0);
ptrP[nV] = ptrP[0];
for(int i(0); i < nV; i++)
dAns += (ptrP[i].x * ptrP[i + 1].y - ptrP[i + 1].x * ptrP[i].y);
printf ("%lf", fabs (dAns / 2.0));
return 0;
}