Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.141 s | 14 KBi |
#2 |
Correcto
|
0.123 s | 12 KBi |
#3 |
Correcto
|
0.143 s | 13 KBi |
#4 |
Correcto
|
0.118 s | 16 KBi |
#5 |
Correcto
|
0.116 s | 16 KBi |
#6 |
Correcto
|
0.114 s | 17 KBi |
#7 |
Correcto
|
0.144 s | 16 KBi |
#8 |
Correcto
|
0.13 s | 16 KBi |
#9 |
Correcto
|
0.142 s | 16 KBi |
#10 |
Correcto
|
0.151 s | 14 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int arr[] = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } int c = sc.nextInt(); for (int i = 0; i < c; i++) { int j = sc.nextInt(); System.out.println(Check(j, arr)); } sc.close(); } public static int Check(int j, int[] arr) { int cont = 0; for (int i = 0; i < arr.length; i++) { if (j < arr[i]) { cont++; } } return cont; } }