Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.165 s | 14 KBi |
#2 |
Correcto
|
0.159 s | 13 KBi |
#3 |
Correcto
|
0.16 s | 15 KBi |
#4 |
Correcto
|
0.184 s | 13 KBi |
#5 |
Correcto
|
0.199 s | 14 KBi |
#6 |
Correcto
|
0.2 s | 14 KBi |
#7 |
Correcto
|
0.155 s | 13 KBi |
#8 |
Correcto
|
0.142 s | 13 KBi |
#9 |
Correcto
|
0.193 s | 15 KBi |
#10 |
Correcto
|
0.203 s | 15 KBi |
#11 |
Correcto
|
0.202 s | 15 KBi |
#12 |
Correcto
|
0.205 s | 19 KBi |
import java.util.*; public class Main { public static void main(String[] args) { String numero1, numero2; Scanner numeros = new Scanner(System.in); numero1 = numeros.nextLine(); numero2=""; numero2 += numeros.nextLine(); numeros.close(); 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()))?"Ordenado":"Desordenado"); } }