Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Patuljci
- {
- public static void main(String[] args)
- {
- Kattio io = new Kattio(System.in);
- List<Integer> hats = new ArrayList<Integer>();
- for (int i = 0; i < 9; i++)
- hats.add(io.getInt());
- int index = 0;
- while (true)
- {
- Collections.shuffle(hats);
- index = 0;
- int sum = 0;
- while (sum < 99 && index < 9)
- sum += hats.get(index++);
- if (sum == 99)
- break;
- }
- for (int i = 0; i < index; i++)
- io.println(hats.get(i));
- io.flush();
- }
- }
Add Comment
Please, Sign In to add comment