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

Envío 5072

Problema 0x9d - ¿Está ordenado?

  • Autor: jarangolp
  • Fecha: 2021-10-10 01:10:18 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
0.057 s 6 KBi
#2
Incorrecto
0.053 s 6 KBi
#3
Incorrecto
0.048 s 7 KBi
#4
Incorrecto
0.047 s 7 KBi
#5
Incorrecto
0.046 s 7 KBi
#6
Incorrecto
0.056 s 7 KBi
#7
Incorrecto
0.068 s 7 KBi
#8
Incorrecto
0.056 s 6 KBi
#9
Incorrecto
0.051 s 7 KBi
#10
Incorrecto
0.059 s 7 KBi
#11
Incorrecto
0.05 s 7 KBi
#12
Incorrecto
0.053 s 7 KBi
Puntos totales: 0 / 100

Código

const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let ordenado = true;
rl.question('', (n) => {
  rl.question('', (numbersString) => {
    if (numbersString.length > 0) {
      const numbers = numbersString.split(' ').map(n => Number(n));
      console.log(numbers);
      for(let i = 1; i < numbers.lenght; i++) {
        if (number[i-1] > number[i]) {
          ordenado = false;
          break;
        }
      }
    }
    console.log(ordenado ? 'Ordenado' : 'Desordenado');
    rl.close();
  });
});