CodeForces - 706B 二分stl

2017-12-29 17:33:53 浏览数 (1)

代码语言:javascript复制
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn = 1000010;
int value[maxn];
int money[maxn];
int n,m;
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i  )
        scanf("%d",&value[i]);
    scanf("%d",&m);
    for(int i=0;i<m;i  )
        scanf("%d",&money[i]);
    sort(value,value n);
    for(int i=0;i<m;i  )
    {
        int pos = upper_bound(value,value n,money[i])-value;
        cout<<pos<<endl;
    }
}
stl

0 人点赞