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

Envío 6873

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

  • Autor: Justin
  • Fecha: 2023-02-19 02:09:31 UTC (Hace alrededor de 1 año)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.111 s 13 KBi
#2
Correcto
0.111 s 13 KBi
#3
Correcto
0.07 s 17 KBi
#4
Correcto
0.104 s 13 KBi
#5
Correcto
0.097 s 13 KBi
#6
Correcto
0.122 s 14 KBi
#7
Correcto
0.133 s 13 KBi
#8
Correcto
0.164 s 13 KBi
#9
Correcto
0.133 s 14 KBi
#10
Correcto
0.144 s 14 KBi
Puntos totales: 100 / 100

Código

class Main {
	public static void main(String[] args) {
		
		int contador = 0;
		
		java.util.Scanner inp = new java.util.Scanner(System.in);
		int n = inp.nextInt();
		
		int numbers[] = new int[n];
		
		for(int i = 0; i < n; i++) {
			numbers[i] = inp.nextInt();
		}
		
		int c = inp.nextInt();
		
		for(int i = 0; i < c; i++) {
			int x = inp.nextInt();
			
			for(int j = 0; j < numbers.length; j++) {
				if(numbers[j] > x) contador++;
			}
			System.out.println(contador);
			contador = 0;
		}
	}
}