█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 4229

Problema 0x9d - ¿Está ordenado?

  • Autor: andres0608
  • Fecha: 2021-05-29 23:49:17 UTC (Hace casi 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#2
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#3
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#4
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#5
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#6
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#7
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#8
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#9
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#10
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#11
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
#12
Error de compilación
                      Main.java:31: error: reached end of file while parsing
}
 ^
1 error

                    
Puntos totales: 0 / 100

Código

import java.util.*;
public class Main {

public static void main(String[] args) {
String  numero1, numero2;
Scanner numeros = new Scanner(System.in);
numero1 = numeros.next();
numero2 = numeros.next();

String[] numbers = numero2.split(" ");
String temp;


for (int i=0; i < Integer.parseInt(numero1); i++){
for (int j=0; j < Integer.parseInt(numero1); j++){	
if(Integer.parseInt(numbers[j])  > Integer.parseInt(numbers[i])){
temp = numbers[i];
numbers[i] = numbers[j];
numbers[j] = temp;
}
}

}
String valores="";
for(int k=0;k < numbers.length; k++){
valores+=numbers[k] + " ";
}

System.out.println((numero2.equals(valores.trim()))?"Ordernado":"Desordenado");   

}