-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11242.cpp
More file actions
48 lines (45 loc) · 789 Bytes
/
Copy path11242.cpp
File metadata and controls
48 lines (45 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#define foi( i , n , k ) for( int i = n ; i < k ; ++i )
using namespace std;
int main()
{
int f,r;
while( scanf("%d",&f)!=EOF && f != 0)
{
scanf("%d",&r);
vector<double> ff(f),rr(r),fr;
foi( i , 0 , f)
{
scanf("%lf",&ff[i]);
}
foi( i , 0 , r )
{
scanf("%lf",&rr[i]);
}
foi( i , 0 , r )
{
foi( j , 0 , f)
{
fr.push_back(rr[i]/ff[j]);
}
}
sort( fr.begin() , fr.end() );
double db;
foi( i , 0 , (int)fr.size() -1 )
{
if( i == 0 )
{
db=fr[i+1]/fr[i];
}
else if(fr[i+1]/fr[i] > db)
{
db=fr[i+1]/fr[i];
}
}
printf("%.2lf\n",db);
}
return 0;
}