Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner input = new Scanner(System.in);
  8. int a = input.nextInt();
  9.  
  10. for (int i = 0; i < a ; i++) {
  11. if (i ==0){
  12. continue;
  13. }
  14. String [] vhod = input.nextLine().split(",");
  15. int [] list = new int[vhod.length];
  16.  
  17. for (int j = 0; j < vhod.length ; j++) {
  18. list[j] = Integer.parseInt(vhod[j]);
  19. }
  20.  
  21. System.out.println(Arrays.toString(list));
  22. int [] list1= list.clone();
  23. Arrays.sort(list1);
  24. System.out.println(Arrays.toString(list1));
  25. if (Arrays.equals(list,list1)){
  26. System.out.println("true");
  27. }
  28. else {
  29. System.out.println("false");
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement