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

Envío 4095

Problema 0x9d - ¿Está ordenado?

  • Autor: TacoMeister
  • Fecha: 2021-05-11 01:16:56 UTC (Hace casi 3 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.173 s 28 KBi
#2
Correcto
0.213 s 14 KBi
#3
Incorrecto
0.113 s 12 KBi
#4
Correcto
0.13 s 12 KBi
#5
Incorrecto
0.268 s 13 KBi
#6
Incorrecto
0.142 s 14 KBi
#7
Correcto
0.173 s 13 KBi
#8
Incorrecto
0.125 s 12 KBi
#9
Incorrecto
0.277 s 14 KBi
#10
Incorrecto
0.189 s 14 KBi
#11
Correcto
0.14 s 13 KBi
#12
Correcto
0.282 s 14 KBi
Puntos totales: 50 / 100

Código

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        boolean status=false;
        int size = scanner.nextInt();
        long [] numbers= new long[size];
        for(int i=0;i<size;i++){
            numbers[i]=scanner.nextLong();
        }
        for(int j=0;j<size-1;j++){
            if(numbers[j]<numbers[j+1]){
                status=true;
            }else{
                break;
            }
        }
        if (status==true) {
            System.out.println("Ordenado");
        } else {
            System.out.println("Desordenado");
        }
    }
}