【洛谷OJ】P1046 陶陶摘苹果

import java.util.Scanner;

public class Main{
    private static Scanner cin;
    public static int STOOL_HEIGHT = 30;
    
    public static void main(String args[])throws Exception {
        cin = new Scanner(System.in);
        int[] x = new int[10];
        int tmp= 0;
        for(int i=0; i<10;i++) {
            tmp = cin.nextInt();
            if(tmp >=100 && tmp <=200) {
                x[i] = tmp;
            }else {
                x[i] = 0;
            }
        }
        int height = cin.nextInt();
        int totalHeight = height + STOOL_HEIGHT;
        int ret = 0;
        if (height >= 100 && height <= 120) {
            for(int i=0; i<10;i++) {
                if(totalHeight >= x[i] && 0 !=x[i]) {
                    ret++;
                }
            }
        }
                
        System.out.println(ret);
    }
}

猜你喜欢

转载自blog.csdn.net/axwolfer/article/details/81676385
今日推荐