Cod sursa(job #900362)
Utilizator | Data | 28 februarie 2013 19:17:46 | |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include<cstdio>
#include<algorithm>
#define Nmax 100009
#define x first
#define y second
using namespace std;
int n,i;
double s;
pair<double,double> a[Nmax];
int main()
{
freopen("aria.in","r",stdin);
freopen("aria.out","w",stdout);
scanf("%d",&n);
for (i=1;i<=n;i++)
scanf("%lf%lf",&a[i].x,&a[i].y);
a[n+1]=a[1];
for (i=2;i<=n+1;i++)
s+=(a[i-1].x*a[i].y - a[i-1].y*a[i].x);
if (s<0) s=-s;
printf("%lf",s/2.0);
}