-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path215A - Bicycle Chain.cpp
More file actions
46 lines (37 loc) · 854 Bytes
/
215A - Bicycle Chain.cpp
File metadata and controls
46 lines (37 loc) · 854 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
// contest: Codeforces Round #132 (Div. 2), problem: (A) Bicycle Chain, Accepted, #, Copy
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
int m;
cin>>m;
int b[m];
for(int i=0;i<m;i++) cin>>b[i];
int max = 0,c=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
float v = b[j]*1.0/a[i];
int val = b[j]/a[i];
if(val==v){
if(val>=max) {
max =val;
}
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
float v = b[j]*1.0/a[i];
if(v==max) {
c++;
}
}
}
cout<<c;
return 0;
}