zoukankan      html  css  js  c++  java
  • 牛客网 拼多多校招-六一儿童节

    import java.io.*;
    import java.util.*;
    
    public class Main{
        public static int patch(int[] h,int[] w){
            Arrays.sort(h);
            Arrays.sort(w);
            int res = 0;
            int d = 0;
            for (int i=0;i < w.length;i++){
                for(int j=d;j < h.length;j++){
                   if (w[i] >= h[j]){
                       d = j + 1;
                       res ++;
                       break;
                   }
                }
            }
            return res;
        }
        public static void main(String[] args) throws IOException{
            BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
            int wn = Integer.parseInt(bf.readLine());
            String[] sh = bf.readLine().split(" ");
            int wm = Integer.parseInt(bf.readLine());
            String[] sm = bf.readLine().split(" ");
            
            int[] h = new int[sh.length];
            int[] m = new int[sm.length];
            for (int i = 0; i < sh.length; i++)
                h[i] = Integer.parseInt(sh[i]);
            for (int i = 0; i < sm.length; i++)
                m[i] = Integer.parseInt(sm[i]);
            System.out.println(patch(h, m));
        }
    }
    
  • 相关阅读:
    SCOI2012 奇怪的游戏
    AHOI2013 差异
    HAOI2018 染色
    HNOI2015 开店
    PKUWC2018 随机游走
    HAOI2015 按位或
    Luogu4859 二项式反演
    CTSC2018 混合果汁
    yii2.0邮件发送问题解决
    yii2.0 elasticsearch模糊查询
  • 原文地址:https://www.cnblogs.com/whyaza/p/10673991.html
Copyright © 2011-2022 走看看