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

Envío 7305

Problema 0x9d - ¿Está ordenado?

  • Autor: manuel claros
  • Fecha: 2024-05-14 17:56:13 UTC (Hace 4 meses)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
0.073 s 15 KBi
#2
Incorrecto
0.069 s 15 KBi
#3
Incorrecto
0.076 s 16 KBi
#4
Incorrecto
0.07 s 16 KBi
#5
Incorrecto
0.062 s 16 KBi
#6
Incorrecto
0.071 s 16 KBi
#7
Incorrecto
0.071 s 15 KBi
#8
Incorrecto
0.067 s 15 KBi
#9
Incorrecto
0.079 s 16 KBi
#10
Incorrecto
0.093 s 16 KBi
#11
Incorrecto
0.094 s 16 KBi
#12
Incorrecto
0.06 s 16 KBi
Puntos totales: 0 / 100

Código

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // Leer el número de elementos en el arreglo
        int N = scanner.nextInt();

        // Leer los elementos del arreglo
        int[] arreglo = new int[N];
        for (int i = 0; i < N; i++) {
            arreglo[i] = scanner.nextInt();
        }

        // Verificar si el arreglo está ordenado
        
    

  
    
        for (int i = 0; i < arreglo.length - 1; i++) {
            if (arreglo[i] > arreglo[i + 1]) {
                System.out.print("Desordenado");
            }else
        {System.out.print("Ordenado");
}
    }
}}