Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

what is wrong?????????????

Posted by suby at 2006-01-30 14:47:32 on Problem 2722
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator