Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package cos;
  2.  
  3. import java.util.*;
  4. import java.util.stream.Collectors;
  5.  
  6. public class SPOJ {
  7.  
  8. public static void main(String[] args) {
  9.  
  10. List<Integer> liczby = new ArrayList<>();
  11.  
  12. Scanner scanner = new Scanner(System.in);
  13.  
  14. int ileLiczb = scanner.nextInt();
  15.  
  16.  
  17. for (int i = 0; i < ileLiczb; i++) {
  18. liczby.add(scanner.nextInt());
  19. }
  20. Collections.reverse(liczby);
  21. liczby = liczby.stream().distinct().collect(Collectors.toList());
  22. System.out.println(liczby);
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement