Taotao picked apple

Source: Internet
Author: User

Taotao picked apple
[Problem description]
There is an apple tree in the yard of taotao's house. Every fall, the tree will produce 10 apples. When Apple matures, Tao will go to pick up the apple.
Tao has a bench with a height of 30 cm. When she cannot pick the apple directly with her hand, she will step on the bench and try again.
Now we know the height of 10 apples to the ground, and the maximum height that can be reached when Tao's handles are stretched. Please help Tao calculate the number of apples She can pick.
If she encounters an apple, the apple will fall.
[Input file]
The input file apple. In contains two rows of data. The first line contains 10 integers (in centimeters) between 100 and 200 (including 100 and 200)
Represents the height of 10 apples to the ground, and two adjacent integers are separated by a space.
The second row only contains an integer (in centimeters) between 100 and 120 (including 100 and 120), which indicates the maximum height that can be reached when the tao handles straighten.
[Output file]
The output file "apple. Out" contains one row. This row contains only one integer, indicating the number of apples that Tao can extract.
[Example input]
100 200 150 140 129 134 167 198 200 111
110
[Sample output]
5

Import Java. io. bufferedinputstream; import Java. util. *; public class Apple {public static void main (string [] ARGs) {consumer SC = new consumer (New bufferedinputstream (system. in); string S = SC. nextline (); int n = SC. nextint (); int sum = N + 30; string STR [] = S. split ("\ s +"); int COUNT = 0; For (INT I = 0; I <Str. length; I ++) {If (integer. parseint (STR [I]) <= sum) {count ++ ;}} system. out. println (count );}}

 

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.