-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdivideArray.java
More file actions
31 lines (29 loc) · 777 Bytes
/
divideArray.java
File metadata and controls
31 lines (29 loc) · 777 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
import java.util.*;
public class divideArray {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int max = 0;
int size = sc.nextInt();
int[] arr = new int[size];
for (int i = 0; i < size; i++) {
arr[i] = sc.nextInt();
if (arr[i] > max) {
max = arr[i];
}
}
int q = sc.nextInt();
while (q > 0) {
q--;
int d = sc.nextInt();
if (d < max) {
for (int i = 0; i < size; i++) {
arr[i] = arr[i] / d;
}
}
}
for (int i = 0; i < size; i++) {
System.out.print(arr[i] + " ");
}
sc.close();
}
}