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

Envío 2803

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

  • Autor: sancanella
  • Fecha: 2021-02-06 20:54:21 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.157 s 16 KBi
#2
Correcto
0.155 s 15 KBi
#3
Correcto
0.171 s 16 KBi
#4
Correcto
0.155 s 16 KBi
#5
Correcto
0.156 s 16 KBi
#6
Correcto
0.158 s 16 KBi
#7
Correcto
0.181 s 16 KBi
#8
Correcto
0.187 s 16 KBi
#9
Correcto
0.205 s 16 KBi
#10
Correcto
0.214 s 16 KBi
Puntos totales: 100 / 100

Código

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner teclado = new Scanner(System.in);
        teclado.nextLine();
        String[] entradas = teclado.nextLine().split(" ");
        int[] entint = new int[entradas.length];
        for (int i = 0; i < entradas.length; i++) {
            entint[i] = Integer.parseInt(entradas[i]);
        }
        
        int checks = Integer.parseInt(teclado.nextLine());
        for (int i = 0; i < checks; i++) {
            int in = Integer.parseInt(teclado.nextLine());
            int times = 0;
            for (int j = 0; j < entint.length; j++) {
                if(in < entint[j]){
                    times++;
                }
            }
            
            System.out.println(times);
        }
        
        
    }
}