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

Envío 6414

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

  • Autor: AmarieV
  • Fecha: 2022-07-05 16:42:05 UTC (Hace casi 2 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.006 s 13 KBi
#2
Correcto
0.004 s 0 KBi
#3
Correcto
0.001 s 0 KBi
#4
Correcto
0.004 s 3 KBi
#5
Correcto
0.004 s 12 KBi
#6
Correcto
0.001 s 0 KBi
#7
Correcto
0.002 s 0 KBi
#8
Correcto
0.002 s 0 KBi
#9
Correcto
0.004 s 0 KBi
#10
Correcto
0.002 s 0 KBi
Puntos totales: 100 / 100

Código

#include <iostream>
using namespace std;

int main(){
  int N;
  cin >> N;
  int *M = new int[N];
  for (int*p = M; p < M + N; p++) {
    cin >> *p;
  }
  int C;
  cin >> C;

  int *K = new int[C];
  for (int*p = K; p < K + C; p++) {
    cin >> *p;
  }

  for (int*p = K; p < K + C; p++) {
    int cont = 0;
    for (int *l = M; l < M + N; l++) {
      if (*l > *p) {
        cont++;
      }
    }
    cout << cont << endl;
  }

  delete [] M;
  M = nullptr;
  delete [] K;
  K = nullptr;
  return 0;
}