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

数据通过为什么????Wrong answer!!!!!!!!!!!

Posted by y05zyg at 2007-08-16 16:33:20 on Problem 3300
# include<iostream.h>
# include<stdlib.h>
int comp(const void*a,const void*b)
{
	return *(double *)a > *(double *)b ? 1 : -1; 
	
}
int main()
{
	int f;
	int r;
	double ff[10];
	double rr[10];
	double s[100];
	double R[100];
	int i,j;
	int k,b;  
	while(1)
	{
		cin>>f ;
		if(f==0)
			break; 
		cin>>r;		
		for(i=0;i<f;i++)
		{
			cin>>ff[i];
		}
		for(j=0;j<r;j++)
		{
			cin>>rr[j];
		}
		for(k=0;k<f*r;)
		{
			for(i=0;i<f;i++)
			{
				for(j=0;j<r;j++)
				{
					s[k]= rr[j]/ff[i]; 
					
					k++;
				}
			}
			
		}
		qsort(s,r*f-1,sizeof(double),comp);		
		for( k=0;k<f*r;)
		{
			for(i=1;i<f*r;i++)
			{
				R[k]=s[i]/s[i-1];
				k++;
			}
		}
		qsort(R,r*f,sizeof(double),comp); 
		cout.setf(ios::fixed);
		cout.precision (2);	   
		cout<<R[f*r-1]<<endl;
		  }
	return 0; 	
}

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