Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.096 s | 16 KBi |
#2 |
Correcto
|
0.097 s | 16 KBi |
#3 |
Correcto
|
0.079 s | 16 KBi |
#4 |
Correcto
|
0.102 s | 16 KBi |
#5 |
Correcto
|
0.116 s | 16 KBi |
#6 |
Correcto
|
0.081 s | 16 KBi |
#7 |
Correcto
|
0.118 s | 17 KBi |
#8 |
Correcto
|
0.12 s | 16 KBi |
#9 |
Correcto
|
0.119 s | 16 KBi |
#10 |
Correcto
|
0.124 s | 17 KBi |
import java.util.*; public class Main { public static void main(String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] array= new int[n]; for(int i= 0; i<n; i++){ array[i]=sc.nextInt(); } int s = sc.nextInt(); int[] numbers = new int[s]; for(int i= 0; i<s; i++){ numbers[i]=sc.nextInt(); } getRepetitions(array, numbers); } public static void getRepetitions(int []array, int []numbers){ for(int i=0; i<numbers.length; i++){ int current = numbers[i]; int counter=0; for(int j=0; j<array.length; j++){ if(current<array[j]) counter++; } System.out.println(counter); } } // method } //class