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

Envío 2229

Problema 0x62 - Contar elementos mayores a X en un arreglo pequeño

  • Autor: stivenxito
  • Fecha: 2020-12-06 21:51:43 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#2
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#3
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#4
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#5
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#6
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#7
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#8
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#9
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
#10
Error de compilación
                      Main.java:9: error: cannot find symbol
  elementos[i] = scan.nextnt();
                     ^
  symbol:   method nextnt()
  location: variable scan of type Scanner
Main.java:19: error: cannot find symbol
System.out.prinln(veces);
          ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
2 errors

                    
Puntos totales: 0 / 100

Código

import java.util.Scanner;
class Main {
public static void main(String[] args){
 Scanner scan = new Scanner(System.in);
 
 int n = scan.nextInt();
 int[] elementos = new int[n];
 for(int i=0; i<n; i++){
  elementos[i] = scan.nextnt();
 }
 
int nConsultas = scan.nextInt();
for(int i=1; i<=nConsultas; i++){
 int numero = scan.nextInt();
 int veces = 0;
 for(int j: elementos){
 if(j>numero) veces++;
}
System.out.prinln(veces);
}


}



}