arun is in a class with N students he knows the height of each student in the class. he then tries to answer Q queries. in each query, he is given an integer X and he has to find the number of students in the class who have a height of at least X
I/p: the 1st line of input two space separated integers N & Q. The second line of input contains N space separated integers, the height of the N students in the class. each of the next Q lines contain one single integer X.
output: the output consists of Q lines where each line contains the answer of J th query (1<=j<=0)
I/p: 3 1
100 160 130
120
O/p: 2
input: 5 5
1 2 3 4 5
6
5
4
3
2
output:
1
2
3
4
n, m = map(int, input().split())
h = map(int, input().split())
for i in range(m):
x = int(input())
r = 0
for y in h:
if x <= h:
r = r + 1
print(r)
Comments
Leave a comment