zoukankan      html  css  js  c++  java
  • 题解 CF387B 【George and Round】

    题目大家都理解清楚了吧

    其实就是尽量多用已有的题,就要求对自己的题按复杂度由低到高排序,从头到尾遍历,用贪心。排序为了便于比较。然后就是只要普通的遍历枚举就可以辣~

    #include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <cmath>
    #include <cstring>
    #include <cctype>
    #include <vector>
    #include <queue>
    #include <stack>//头文件(管理都不用万能我为神马要用万能)
    using namespace std;
    int n,m,a[1000005],b[1000005],l,r;//不要被这个空间吓着了,放心,不会炸
    using namespace std;
    inline int read()
    {
        int x=0,f=1;char ch=getchar();
        while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
        while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
        return x*f;
    }//快读(cz专用模板)
    int main(){
        n=read(),m=read();
        for(int i=0;i<n;i++)
            a[i]=read();
        for(int i=0;i<m;i++)
            b[i]=read();//输入部分就不详细讲了
        sort(a,a+n);
        sort(b,b+m);//排序,以便后头进行比较分析
        while(l<n&&r<m){//遍历枚举
            if(a[l]<=b[r])
                l++; 
            r++;
        }
        cout<<n-l<<endl;//最后输出掉
        return 0;
    }
     
  • 相关阅读:
    SpringFlex框架搭建
    SqlDataReader的用法 转自https://www.cnblogs.com/sunxi/p/3924954.html
    C#学习笔记:ListBox控件的用法
    C#栈Stack的使用
    C# 队列Queue
    xshell传送文件
    Java基础中字符串与字符的注意点!
    大数据的基础学习:
    Python的空行
    Python基本语法
  • 原文地址:https://www.cnblogs.com/Sworddust/p/11615280.html
Copyright © 2011-2022 走看看