forked from DreamCats/java-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
37 lines (33 loc) · 790 Bytes
/
Main.java
File metadata and controls
37 lines (33 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* @program JavaBooks
* @description: 牛客
* @author: mf
* @create: 2020/07/24 22:24
*/
package Test;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int[] hs = new int[h];
for (int i = 0; i < h; i++) {
hs[i] = sc.nextInt();
}
int w = sc.nextInt();
int[] ws = new int[w];
for (int i = 0; i < w; i++) {
ws[i] = sc.nextInt();
}
Arrays.sort(hs);
Arrays.sort(ws);
int i = 0, j = 0;
while (i < h && j < w){
if (hs[i] <= ws[j])
i++;
j++;
}
System.out.println(i);
}
}