-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComparetheTriplets.java
More file actions
66 lines (47 loc) · 1.69 KB
/
Copy pathComparetheTriplets.java
File metadata and controls
66 lines (47 loc) · 1.69 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Solution {
/*
* Complete the solve function below.
*/
static int[] solve(int a0, int a1, int a2, int b0, int b1, int b2) {
int [] result = new int[2];
for (int i = 0; i < result.length; i++) {
result[i] = 0;
}
int[] aPoints = {a0, a1, a2};
int[] bPoints = {b0, b1, b2};
for (int i = 0; i < 3; i++) {
if (aPoints[i] > bPoints[i]) {
result[0] += 1;
} else if (bPoints[i] > aPoints[i]) {
result[1] += 1;
}
}
return result;
}
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
String[] a0A1A2 = scan.nextLine().split(" ");
int a0 = Integer.parseInt(a0A1A2[0].trim());
int a1 = Integer.parseInt(a0A1A2[1].trim());
int a2 = Integer.parseInt(a0A1A2[2].trim());
String[] b0B1B2 = scan.nextLine().split(" ");
int b0 = Integer.parseInt(b0B1B2[0].trim());
int b1 = Integer.parseInt(b0B1B2[1].trim());
int b2 = Integer.parseInt(b0B1B2[2].trim());
int[] result = solve(a0, a1, a2, b0, b1, b2);
for (int resultItr = 0; resultItr < result.length; resultItr++) {
bw.write(String.valueOf(result[resultItr]));
if (resultItr != result.length - 1) {
bw.write(" ");
}
}
bw.newLine();
bw.close();
}
}