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

Envío 6863

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

  • Autor: Justin
  • Fecha: 2023-02-19 01:55:35 UTC (Hace alrededor de 1 año)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.079 s 14 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.092 s 12 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.05 s 15 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.086 s 12 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.083 s 17 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.042 s 15 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.084 s 15 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.08 s 12 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.047 s 15 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
0.043 s 15 KBi
Puntos totales: 0 / 100

Código

import java.util.Scanner;

class CalculoArreglo {
	public static void main(String[] args) {
		
		Scanner inp = new Scanner(System.in);
		int n = inp.nextInt();
		
		int numbers[] = new int[n];
		
		for(int i = 0; i < n; i++) {
			numbers[i] = inp.nextInt();
		}
		
		int queries = inp.nextInt();
		
		for(int i = 0; i < queries; i++) {
			int x = inp.nextInt();
			int contador = 0;
			for(int j = 0; j < n; j++) {
				if(numbers[j] > x) contador++;
			}
			System.out.println(contador + "\n");
		}
		
		
		inp.close();
	}
}