SHARE
TWEET

Untitled

a guest Jul 17th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top