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

求求各位牛人帮忙看看吧!谢谢了!!!!!!!!!!!

Posted by 457 at 2009-01-12 14:48:45 on Problem 3300
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int i,j,k,f,r;
	int a[10],b[10];
	double c[101];
	while(scanf("%d",&f)!=EOF&&f)
	{
	 scanf("%d",&r);
	 for(i=0;i<10;i++)
	 	{a[i]=0;b[i]=0;}
	 for(i=0;i<101;i++)
	 	c[i]=0;
	 for(i=0;i<f;i++)
	 	scanf("%d",&a[i]);
	 for(j=0;j<r;j++)
	 	scanf("%d",&b[j]);
	 double max=0.0,l;
	 k=0;
	 for(i=0;i<f;i++)
	 	for(j=0;j<r;j++)
	 	{
		 c[k]=(double)b[j]/a[i];
		 k++;
		}
	 sort(c,c+k);
	 for(i=0;i<k-1;i++)
	 	if(c[i+1]/c[i]>max)
	 	max=c[i+1]/c[i];
	 printf("%.2lf\n",max+0.005);	
	}
}

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