Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.147 s | 14 KBi |
#2 |
Correcto
|
0.147 s | 12 KBi |
#3 |
Correcto
|
0.146 s | 14 KBi |
#4 |
Correcto
|
0.121 s | 13 KBi |
#5 |
Correcto
|
0.114 s | 12 KBi |
#6 |
Correcto
|
0.142 s | 13 KBi |
#7 |
Correcto
|
0.156 s | 12 KBi |
#8 |
Correcto
|
0.153 s | 16 KBi |
#9 |
Correcto
|
0.132 s | 13 KBi |
#10 |
Correcto
|
0.15 s | 13 KBi |
#11 |
Correcto
|
0.128 s | 13 KBi |
#12 |
Correcto
|
0.164 s | 13 KBi |
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc= new Scanner(System.in); int N = sc.nextInt(); int numberArray[] = new int[N]; for(int i = 0; i < N; i++) { numberArray[i] = sc.nextInt(); } sc.close(); System.out.println((isSorted(numberArray))?"Ordenado":"Desordenado"); } private static boolean isSorted(int[] numberArray) { for (int i = 0; i < numberArray.length - 1; i++) { if (numberArray[i] > numberArray[i + 1]) return false; } return true; } }