|
|
back to boardWhy Test_1 Failed? import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int[] ints = ReadInts(in); int first = ints[0] + ints[1] + ints[2]; int second = ints[3] + ints[4] + ((ints[5] == 9) ? 1 : ints[5] + 1); int third = ints[3] + ints[4] + ((ints[5] == 0) ? 8 : ints[5] - 1); System.out.println((first == second) || (first == third) ? "YES" : "NO"); } public static int[] ReadInts(BufferedReader in) throws IOException { int[] result = new int[6]; String input = in.readLine(); for (int i = 0; i < input.length(); i++) { result[i]=Integer.parseInt(input.substring(i, i + 1)); } return result; } } Re: Why Test_1 Failed? Maybe Yes/No instread of YES/NO? Re: Why Test_1 Failed? yap :) thanks Edited by author 19.02.2009 10:24 Edited by author 19.02.2009 10:24 |
|
|