Cod sursa(job #906793)
| Utilizator | Data | 7 martie 2013 10:10:37 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include<cstdio>
#include<utility>
#define mp make_pair
#define nmax 100010
using namespace std;
pair<double,double>v[nmax];
int n,i;
double a,x,y;
int main()
{
freopen("aria.in","r",stdin);
freopen("aria.out","w",stdout);
scanf("%d", &n);
for(i=1;i<=n;++i){scanf("%lf%lf", &x, &y);v[i]=mp(x,y);}
v[n+1]=v[1];
for(i=1;i<=n;++i)a+=(v[i].first*v[i+1].second-v[i+1].first*v[i].second);
if(a<0)a=-a;
a/=2;
printf("%lf", a);
return 0;
}
