-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBicycle Chain.cpp
More file actions
39 lines (36 loc) · 788 Bytes
/
Copy pathBicycle Chain.cpp
File metadata and controls
39 lines (36 loc) · 788 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
#include <iostream>
//4034009 Jan 15, 2023 10:05:56 PM 215A - Bicycle Chain GNU C++0x Accepted 15 ms 0 KB
using namespace std;
int main()
{
int n, m, a[50], b, max(0), count(1);
cin >> n;
for (int i = 0; i < n; ++i)
{
cin >> a[i];
}
cin >> m;
for (int i = 0; i < m; ++i)
{
cin >> b;
for (int j = 0; j < n; ++j)
{
if (b % a[j] == 0)
{
int x = b / a[j];
if (x > max)
{
max = x;
count = 1;
}
else if (x == max)
{
count += 1;
}
break;
}
}
}
cout << count << endl;
return 0;
}