-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuva11242.cpp
More file actions
41 lines (34 loc) · 848 Bytes
/
uva11242.cpp
File metadata and controls
41 lines (34 loc) · 848 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
/* Rishikesh
* UVA 11242 Tour de France
*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;
int main() {
int f,r;
while(cin >> f, f) {
cin >> r;
vector<double> front, rear;
vector<double> d;
for(int i=0; i < f; i++) {
double t; cin >> t;
front.push_back(t);
}
for (int i = 0; i < r; i++) {
double t; cin >> t;
rear.push_back(t);
}
for(int i = 0; i < f; i++) {
for (int j = 0; j < r; j++) {
d.push_back(front[i]/rear[j]);
}
}
sort(d.begin(), d.end());
for(int i = 0; i< d.size() -1; i++) {
d[i] = d[i+1]/d[i];
}
printf("%0.2f\n", *max_element(d.begin(),prev(d.end())));
}
}