반응형
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.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int[] solve(int a0, int a1, int a2, int b0, int b1, int b2){ // Complete this function int[] result = new int[2]; result[0] = result[1] = 0; if(a0 < b0) result[1]++; if(a0 > b0) result[0]++; if(a1 < b1) result[1]++; if(a1 > b1) result[0]++; if(a2 < b2) result[1]++; if(a2 > b2) result[0]++; return result; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int a0 = in.nextInt(); int a1 = in.nextInt(); int a2 = in.nextInt(); int b0 = in.nextInt(); int b1 = in.nextInt(); int b2 = in.nextInt(); int[] result = solve(a0, a1, a2, b0, b1, b2); for (int i = 0; i < result.length; i++) { System.out.print(result[i] + (i != result.length - 1 ? " " : "")); } System.out.println(""); } } | cs |
'알고리즘 > Hackerrank' 카테고리의 다른 글
Hackerrank - Taum and B'day (0) | 2018.10.21 |
---|---|
Jumping on the Clouds (0) | 2018.10.11 |
Equalize the Array (0) | 2018.10.10 |
ACM ICPC Team (0) | 2018.10.10 |
A very big sum (0) | 2018.10.09 |