Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.101 s | 12 KBi |
#2 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.108 s | 17 KBi |
#3 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.095 s | 13 KBi |
#4 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.106 s | 18 KBi |
#5 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.092 s | 12 KBi |
#6 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.094 s | 11 KBi |
#7 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.096 s | 12 KBi |
#8 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.086 s | 11 KBi |
#9 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.1 s | 11 KBi |
#10 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Error: Main method is not static in class Main, please define the main method as: public static void main(String[] args) |
0.085 s | 25 KBi |
import java.util.Scanner; public class Main { public void main(String[] args) { Scanner scanner = new Scanner(System.in); int numberCase = scanner.nextInt(); for(int n = 0; n < numberCase; n++){ int building = scanner.nextInt(); int[] arrTall = new int[building]; String arrCovered = ""; for(int i = 0; i < arrTall.length; i++){ arrTall[i] = scanner.nextInt(); } /*for (int i = 0; i < arrTall.length; i++) { boolean flag = false; for(int j = i+1; j < arrTall.length; j++){ if(arrTall[i] < arrTall[j]){ flag = true; arrCovered = arrCovered + " " + arrTall[j]; break; } } if(flag == false){ arrCovered = arrCovered + " " + -1; } }*/ /* * {1, 2, 3} * * */ for (int i = 0; i < arrTall.length; i++) { boolean flag = false; int count = 0; int valueTemp = 0; for(int j = i+1; j < arrTall.length; j++){ if(arrTall[i] < arrTall[j]){ flag = true; valueTemp = arrTall[j]; arrCovered = arrCovered + " " + arrTall[j]; break; } else { count++; } } if (count > 0) { this.setValue(count, valueTemp); i = count; } if(flag == false){ arrCovered = arrCovered + " " + -1; } } System.out.print("Case #"+(n+1)+":" + arrCovered); System.out.println(); } } private String setValue(int number, int value) { String valueBuilder = ""; for (int i = 0; i<number; i++) { valueBuilder = valueBuilder + " " +value; } return valueBuilder; } }