• codeforces600B


    sol:简单题,复习一下upper_bound

    #include <bits/stdc++.h>
    using namespace std;
    typedef int ll;
    inline ll read()
    {
        ll s=0; bool f=0; char ch=' ';
        while(!isdigit(ch)) {f|=(ch=='-'); ch=getchar();}
        while(isdigit(ch)) {s=(s<<3)+(s<<1)+(ch^48); ch=getchar();}
        return (f)?(-s):(s);
    }
    #define R(x) x=read()
    inline void write(ll x)
    {
        if(x<0) {putchar('-'); x=-x;}
        if(x<10) {putchar(x+'0'); return;}
        write(x/10); putchar((x%10)+'0');
    }
    #define W(x) write(x),putchar(' ')
    #define Wl(x) write(x),putchar('
    ')
    const int N=200005;
    int n,m,a[N],b[N];
    int main()
    {
        int i;
        R(n); R(m);
        for(i=1;i<=n;i++) R(a[i]);
        for(i=1;i<=m;i++) R(b[i]);
        sort(a+1,a+n+1);
        for(i=1;i<=m;i++)
        {
            W(upper_bound(a+1,a+n+1,b[i])-a-1);
        }
        return 0;
    }
    View Code
    河田は河田、赤木は赤木……。 私は誰ですか。教えてください、私は誰ですか。 そうだ、俺はあきらめない男、三井寿だ!
  • 相关阅读:
    test14
    test13
    test12
    test11
    Xcode常用快捷键
    OC弱语法
    对象的结构体属性的成员修改
    IOS 获取手机各种信息
    IOS app启动过程
    iOS退出键盘的两种方式
  • 原文地址:https://www.cnblogs.com/gaojunonly1/p/15456529.html
Copyright © 2020-2023  润新知