解题思路:
简单的比较录入值,使用for循环遍历比较就行。
代码实现:
import java.util.Scanner;
public class P1046 {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int [] a = new int[10];
for (int i = 0; i < 10; i++) {
a[i]=sc.nextInt();
}
int height = sc.nextInt();
height+=30;
int count = 0;
for (int i = 0; i < 10 ; i++) {
if(a[i]<=height){
count++;
}
}
System.out.println(count);
}
}