Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,m,f[200],r[200],i,j,k,a,b;
- double d[200];
- while(scanf("%d",&a)==1)
- {
- scanf("%d",&b);
- if(a==0)
- break;
- for(i=0;i<a;i++)
- cin>>f[i];
- for(j=0;j<b;j++)
- cin>>r[j];
- k=0;
- for(i=0;i<b;i++)
- {
- for(j=0;j<a;j++)
- {
- d[k++]=(double)r[i]/(double)f[j];
- }
- }
- sort(d,d+k);
- double max=-1.00;
- for(i=0;i<k-1;i++)
- {
- double x=d[i+1]/d[i];
- if(x>max)
- max=x;
- }
- printf("%.2lf\n",max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement