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

Envío 5475

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

  • Autor: nivalderramas
  • Fecha: 2021-12-22 12:58:59 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.005 s 8 KBi
#2
Correcto
0.004 s 5 KBi
#3
Correcto
0.003 s 4 KBi
#4
Correcto
0.003 s 0 KBi
#5
Correcto
0.004 s 1 KBi
#6
Correcto
0.002 s 0 KBi
#7
Correcto
0.005 s 0 KBi
#8
Correcto
0.004 s 2 KBi
#9
Correcto
0.007 s 0 KBi
#10
Correcto
0.006 s 0 KBi
Puntos totales: 100 / 100

Código

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<n;i++)
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define lli long long int
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
ostream& operator<<(ostream& os, const vector<int> &v){
    for(auto const &i: v){
        os<<i<<" ";
    }
    os<<endl;
    return os;
}
const lli mod=(1e9)+7;
const int N = 1e4+1;
int main(){
    fast_io;
    int n;
    cin>>n;
    int nums[n];
    REP(i,n)cin>>nums[i];
    int c;
    cin>>c;
    while(c--){
        int x;cin>>x;
        int ans = 0;
        REP(i,n){
            if(nums[i]>x)ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}