跑跑卡丁车系列之游戏下载
跑
跑
卡
丁
车
系
列
之
游
戏
下
载
某天,金斌在实验室玩跑跑卡丁车,众多群巨也一起加入其中。蛋蛋发现这是一个虐爆群巨的好机会,所以他也准备去下载游戏了!
但是由于不可抗力的原因,113的网速灰常快(man),所以每个群巨都有一个ai值。如果群巨当前网速小于这个值,那么群巨就会小情绪!!!
现在给出当前网速x,问有多少人没有小情绪。(假设:每个人都是x)
Input
测试数据有多组,每组输入一个N ( N <= 1e8 ),下一行输入N个数 ,表示每个人的ai值 ( ai < 1000)。接着输入一个Q( 1<= Q <=1e5),表示有Q个询问。每个询问输出一个数字。
Output
对于每个询问输出,在当前状态下,有多少人没有小情绪。
Sample Input
6
1 2 3 4 5 6
3
2
3
7
Sample Output
2
3
6
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[10000010];
int main(){
int n;
while(cin>>n){
for(int i = 0;i<n;i++){
cin>>a[i];
}
sort(a,a+ n);
int t;
cin>>t;
while(t--){
int x;
cin>>x;
cout<<(upper_bound(a,a+n,x)-a)<<endl;
}
}return 0;
}