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

Envío 4228

Problema 0x9d - ¿Está ordenado?

  • Autor: andres0608
  • Fecha: 2021-05-29 23:48:06 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#2
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#3
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#4
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#5
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#6
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#7
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#8
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#9
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#10
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#11
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
#12
Error de compilación
                      Main.java:15: error: incompatible types: int cannot be converted to String
for (int i=0; i < Integer.parseInt(numero1); i++){
                                   ^
Main.java:16: error: incompatible types: int cannot be converted to String
for (int j=0; j < Integer.parseInt(numero1); j++){	
                                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors

                    
Puntos totales: 0 / 100

Código

import java.util.*;
public class Main {

public static void main(String[] args) {
int numero1;
String numero2;
Scanner numeros = new Scanner(System.in);
numero1 = numeros.nextInt();
numero2 = numeros.next();

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()))?"Ordernado":"Desordenado");   

}
}