牛客网 拼多多校招-六一儿童节

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));
    }
}
上一篇:【转载】C#将图片转换为二进制流调用


下一篇:java 日期格式化