-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem47.java
More file actions
48 lines (38 loc) · 1.11 KB
/
Problem47.java
File metadata and controls
48 lines (38 loc) · 1.11 KB
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
47
48
package dimikOJ;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Problem47 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
int T = input.nextInt();
while (T < 1 || T > 1000) {
T = input.nextInt();
}
input.nextLine();
ArrayList<ArrayList<Integer>> aList = new ArrayList<ArrayList<Integer>>(T);
for (int i = 0; i < T; i++) {
ArrayList<Integer> al = new ArrayList<Integer>();
for (int j = 0; j < 2; j++) {
int length = input.nextInt();
input.nextLine();
String temp = input.nextLine();
String[] tempArray = temp.trim().replaceAll("\\s{2,}", " ").split("\\s");
for (int k = 0; k < length; k++) {
int toAdd = Integer.parseInt(tempArray[k]);
al.add(toAdd);
}
}
aList.add(al);
}
input.close();
for (int i = 0; i < T; i++) {
Collections.sort(aList.get(i));
for (int j = 0; j < aList.get(i).size(); j++) {
System.out.print(aList.get(i).get(j) + " ");
}
System.out.println();
}
}
}