Pagini recente » Cod sursa (job #2083349) | Cod sursa (job #1492528) | Cod sursa (job #2617077) | Cod sursa (job #2933337) | Cod sursa (job #2421379)
#include<cstdio>
#define M 1<<16
char r[M];
int e=M,n,i;
double x,y,a,b,c,d;
long double s;
inline char C()
{
if(e==M)
fread(r,1,M,stdin),e=0;
return r[e++];
}
inline double D()
{
char c=C(),s=43;
double a=0;
for(;c<48;c=C())
s=c;
for(;c>47;c=C())
a=a*10+c-48;
if(c==46)
{
double b=0,p=1;
for(;(c=C())>47;p*=10)
b=b*10+c-48;
a+=b/p;
}
return s==45?-a:a;
}
int main()
{
freopen("aria.in","r",stdin),freopen("aria.out","w",stdout);
n=D(),c=D(),d=D(),a=c,b=d;
for(i=1;i<n;i++)
x=D(),y=D(),s+=(long double)a*y-(long double)x*b,a=x,b=y;
s+=(long double)x*d-(long double)y*c;
/*read(n,x1,y1);
xi=x1; yi=y1;
for(i=2; i<=n; i++)
{
read(xj,yj);
s = s + xi*yj-xj*yi;
xi = xj; yi = yj;
}
s = s + xj*y1-x1*yj;
for(n=D(),i=0;i<n;i++)
x[i]=D(),y[i]=D();
x[n]=x[0],y[n]=y[0];
for(i=0;i<n;i++)
s+=(long double)x[i]*y[i+1]-(long double)x[i+1]*y[i];*/
printf("%.5Lf",s/2);
}