Guest User

Untitled

a guest
Jan 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Patuljci
  4. {
  5. public static void main(String[] args)
  6. {
  7. Kattio io = new Kattio(System.in);
  8. List<Integer> hats = new ArrayList<Integer>();
  9.  
  10. for (int i = 0; i < 9; i++)
  11. hats.add(io.getInt());
  12.  
  13. int index = 0;
  14.  
  15. while (true)
  16. {
  17. Collections.shuffle(hats);
  18.  
  19. index = 0;
  20. int sum = 0;
  21.  
  22. while (sum < 99 && index < 9)
  23. sum += hats.get(index++);
  24.  
  25. if (sum == 99)
  26. break;
  27. }
  28.  
  29. for (int i = 0; i < index; i++)
  30. io.println(hats.get(i));
  31.  
  32. io.flush();
  33. }
  34. }
Add Comment
Please, Sign In to add comment