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

Envío 4231

Problema 0x9d - ¿Está ordenado?

  • Autor: andres0608
  • Fecha: 2021-05-29 23:50:44 UTC (Hace casi 3 años)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
0.159 s 13 KBi
#2
Incorrecto
0.149 s 14 KBi
#3
Incorrecto
0.158 s 14 KBi
#4
Incorrecto
0.216 s 14 KBi
#5
Incorrecto
0.225 s 14 KBi
#6
Incorrecto
0.15 s 15 KBi
#7
Incorrecto
0.146 s 13 KBi
#8
Incorrecto
0.138 s 13 KBi
#9
Incorrecto
0.198 s 14 KBi
#10
Incorrecto
0.195 s 13 KBi
#11
Incorrecto
0.151 s 13 KBi
#12
Incorrecto
0.175 s 16 KBi
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 < numbers.length; i++){
for (int j=0; j < numbers.length; 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");   

}
}