比如10个基站的高度依次是12,13,34,9,15,11,9,18,20,22,如下是3个洪水高度:
如果洪水高度是1,那么会分为1组(12,13,34,9,15,11,9,18,20,22)
如果洪水高度是10,那么会分为3组(12,13和34,15,11和18,20,22)
如果洪水高度是11,那么会分为3组(12,13,34和15和18,20,22)
输入:
10
12 13 34 9 15 11 9 18 20 22
3
1
10
11
输出:
1
3
3
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int towerCount = sc.nextInt();
int[] towerHeight = new int[towerCount];
for (int i = 0; i < towerCount; i++) {
towerHeight[i] = sc.nextInt();
}
int floodCount = sc.nextInt();
int[] floodHeight = n