| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
what is wrong?????????????#include <stdio.h>
int n;
double x1,x2,y1,y2,l[10],min,Ax,Ay;
int main()
{
int i;
while(-1)
{
scanf("%d",&n);
if(n==0)
break;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
double xa,ya,sum=0,S=0;
if(x1>x2)
{
xa=x1;x1=x2;x2=xa;
ya=y1;y1=y2;y2=ya;
}
for(i=0;i<n;i++)
{
scanf("%lf",&l[i]);
S+=l[i];
}
if(y1*x2-x1*y2==0)
{
printf("0.000\n");
}
else if(x1==0)
{
Ax=0;
Ay=S+y2/x2*S;
for(i=0;i<n;i++)
{
sum+=Ax*l[i]/2;
Ay-=l[i];
sum+=Ay*l[i]/2;
Ax+=l[i];
}
printf("%.3lf\n",sum);
}
else
{
Ax=S*x1*(y1+y2)/(y1*x2-x1*y2);
Ay=y1*Ax/x1;
for(i=0;i<n;i++)
{
sum+=Ax*l[i]/2;
Ay-=l[i];
sum+=Ay*l[i]/2;
Ax+=l[i];
}
printf("%.3lf\n",sum);
}
}
return 0;
}
plz help me
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator