Pagini recente » Rating tileadavid (tileadavid) | Cod sursa (job #2050232) | Cod sursa (job #593664) | Cod sursa (job #1710484) | Cod sursa (job #970006)
Cod sursa(job #970006)
#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;
}