-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
32 lines (28 loc) · 945 Bytes
/
Solution.java
File metadata and controls
32 lines (28 loc) · 945 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
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Solution {
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
List<Integer> a = new ArrayList<>();
List<Integer> b = new ArrayList<>();
for (int i = 0; i < 3; i++) {
a.add(scan.nextInt());
}
for (int i = 0; i < 3; i++) {
b.add(scan.nextInt());
}
scan.close();
compareTriplets(a, b).forEach(n -> System.out.print(n + " "));
}
static List<Integer> compareTriplets(List<Integer> a, List<Integer> b) {
int aliceScore = 0;
int bobScore = 0;
for (int i = 0; i < a.size(); i++) {
if (a.get(i) > b.get(i)) aliceScore++;
else if (a.get(i) < b.get(i)) bobScore++;
}
return Arrays.asList(aliceScore, bobScore);
}
}