1-6-02: Tata Pick Apples

Source: Internet
Author: User


There is an apple tree in the Tautau's yard, and 10 apples will be produced in every fall tree. When Apple matures, Tata will run to pick apples. Tata had a 30-centimetre-high bench, and when she couldn't pick it up with her hand, she would step on the bench and try again.

Now that you know the height of 10 apples to the ground and the maximum height you can reach when the Tata handle is stretched, help Tata calculate the number of apples she can pick. If she touches an apple, the Apple will fall.

Inputincludes two rows of data. 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 includes only an integer (in centimeters) between 100 and 120 (containing 100 and 120), indicating the maximum height that the Tata can reach when the handle is stretched.Outputincludes a row that contains only an integer that represents the number of apples that Tata can pick up.Sample input
100 200 150 140 129 134 167 198 200 111110
Sample output
 1 #include<stdio.h>
 2 int main()
 3 {
 4     int a[11]={0};
 5     int m,c=0;
 6     for(int i=1;i<=10;i++)
 7         scanf("%d",&a[i]);
 8     scanf("%d",&m);m=m+30;
 9     for(int i=1;i<=10;i++)
10         if(a[i]<=m)    c++;
11     printf("%d\n",c);
12     return 0;
13 }

1-6-02: Tata Pick Apples

Related Article

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.