Xiao Ming, who loves picking apples

Source: Internet
Author: User
Tags ming

Love picking apples time limit:MS | Memory limit:65535 KB Difficulty:1
Describe
There is an apple tree in the yard of Xiao Ming's house, and 10 apples will be produced in every fall tree. When Apple matures, Xiaoming will run to pick apples. Xiao Ming has a 30 cm high bench, when she can not directly pick the apples by hand, will step on the bench and try again.
Now that you know the height of 10 apples to the ground, and the maximum height that xiaoming can reach when you straighten your hand, please help Xiao Ming calculate the number of apples she can pick. If she touches an apple, the Apple will fall.
Input
the first line of input N (0<n<100) represents the number of test data groups, followed by two rows of data for each set of test inputs. The first line contains 10 integers from 100 to 200 (including 100 and 200), each representing 10 apples to the ground height, and two adjacent integers separated by a space. The second line contains only an integer (in centimeters) between 100 and 120 (containing 100 and 120), indicating the maximum height that xiaoming can reach when the hand is straightened.
Output
The
output includes one row, which contains only an integer that indicates the number of apples that xiaoming can pick up.
Sample input
1100 200 150 140 129 134 167 198 200 111110
Sample output
5

Package Acm03;import Java.util.scanner;public class Main1 {private static final int HEIGHT = 30;public static void Main (St Ring[] args) {Scanner input = new Scanner (system.in); int n = Input.nextint (); for (int i = 0;i<n;i++) {int [] array = NE W int[10];for (int j = 0;j<array.length;j++) {Array[j] = Input.nextint ();} int height = input.nextint (); int sum = height + height;int result = count (array,sum); SYSTEM.OUT.PRINTLN (result);}} private static int count (int[] array,int sum) {int count = 0;for (int i = 0;i<array.length;i++) {if (Array[i] <= sum ) {count++;} else {continue;}} return count;}}

  

Xiao Ming, who loves picking apples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.