|
| 1 | +import java.io.BufferedReader; |
| 2 | +import java.io.IOException; |
| 3 | +import java.io.InputStreamReader; |
| 4 | +import java.util.ArrayList; |
| 5 | + |
| 6 | +public class coci06contest31 { |
| 7 | + |
| 8 | + public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); |
| 9 | + |
| 10 | + public static void main(String[] args) throws IOException { |
| 11 | + ArrayList<Integer> dwarves = new ArrayList<Integer>(); |
| 12 | + |
| 13 | + int input; |
| 14 | + int sum = 0; |
| 15 | + for (int i = 0; i < 9; i++) { |
| 16 | + input = readInt(); |
| 17 | + dwarves.add(input); |
| 18 | + sum += input; |
| 19 | + } |
| 20 | + |
| 21 | + boolean stop = false; |
| 22 | + for (int i = 0; i < dwarves.size(); i++) { |
| 23 | + for (int j = 0; j < dwarves.size(); j++) { |
| 24 | + if (sum - dwarves.get(i) - dwarves.get(j) == 100) { |
| 25 | + dwarves.remove(dwarves.get(i)); |
| 26 | + dwarves.remove(dwarves.get(j - 1)); |
| 27 | + stop = true; |
| 28 | + break; |
| 29 | + } |
| 30 | + } |
| 31 | + |
| 32 | + if (stop) { |
| 33 | + break; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + for (int i = 0; i < dwarves.size(); i++) { |
| 38 | + System.out.println(dwarves.get(i)); |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + public static String readLine() throws IOException { |
| 43 | + return in.readLine(); |
| 44 | + } |
| 45 | + |
| 46 | + public static int readInt() throws IOException { |
| 47 | + return Integer.parseInt(readLine()); |
| 48 | + } |
| 49 | + |
| 50 | + public static long readLong() throws IOException { |
| 51 | + return Long.parseLong(readLine()); |
| 52 | + |
| 53 | + } |
| 54 | + public static double readDouble() throws IOException { |
| 55 | + return Double.parseDouble(readLine()); |
| 56 | + } |
| 57 | + |
| 58 | + public static char readCharacter() throws IOException { |
| 59 | + return readLine().charAt(0); |
| 60 | + } |
| 61 | + |
| 62 | + public static String[] readSpaceInput() throws IOException { |
| 63 | + return in.readLine().split(" "); |
| 64 | + } |
| 65 | + |
| 66 | +} |
0 commit comments