Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 1 KBi |
#2 |
Correcto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.004 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.004 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.004 s | 1 KBi |
#8 |
Correcto
|
0.005 s | 1 KBi |
#9 |
Correcto
|
0.004 s | 1 KBi |
#10 |
Correcto
|
0.004 s | 1 KBi |
#include <stdio.h> #include <stdlib.h> int main() { long int size_array = 0, num_consultas = 0, num_arr = 0, contador = 0, consulta = 0, i, j; long int *array = NULL; scanf("%li", &size_array); array = malloc(sizeof(long int) * size_array); if (array == NULL || size_array <= 0) return -1; for (i = 0; i < size_array; i++) { scanf("%li", &num_arr); array[i] = num_arr; } scanf("%li", &num_consultas); for (i = 0; i < num_consultas; i++) { scanf("%li", &consulta); for (j = 0; j < size_array; j++) { if (array[j] > consulta) contador++; } printf("%li\n", contador); contador = 0; } free(array); return 0; }