forked from divy-arpit/CodeSprint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest file
More file actions
40 lines (34 loc) · 1018 Bytes
/
test file
File metadata and controls
40 lines (34 loc) · 1018 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
import java.util.Scanner;
public class electronicsShop {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int b, n, m, i, j;
boolean check = true;
b = in.nextInt();
n = in.nextInt();
m = in.nextInt();
int[] keyBoard = new int[n];
int[] drives = new int[m];
for (i = 0; i < n; i++) {
keyBoard[i] = in.nextInt();
}
for (i = 0; i < m; i++) {
drives[i] = in.nextInt();
}
keyBoard = descendingOrderArray(keyBoard);
drives = descendingOrderArray(drives);
}
static int[] descendingOrderArray(int[] a) {
int i, j, temp, length = a.length;
for (i = 0; i < length - 1; i++) {
for (j = i; j < length; j++) {
if (a[i] < a[j]) {
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
return a;
}
}