forked from paulot/uva2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11242.cpp
More file actions
27 lines (22 loc) · 651 Bytes
/
Copy path11242.cpp
File metadata and controls
27 lines (22 loc) · 651 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
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
int front[11], nf, back[11], nb, nr;
double ratios[200];
int main() {
while (cin >> nf and nf) { cin >> nb;
for (int i = 0; i < nf; i++) cin >> front[i];
for (int i = 0; i < nb; i++) cin >> back[i];
nr = 0;
for (int i = 0; i < nf; i++) for (int j = 0; j < nb; j++) {
ratios[nr++] = ((double) back[j]) / front[i];
}
sort(ratios, ratios + nr);
int best = 0;
for (int i = 1; i < nr; i++) best = max(best, (int) round(((ratios[i] / ratios[i - 1]) * 100)));
printf("%.2f\n", (best / 100.0));
}
return 0;
}