Luo Tao Tao Gu P1046 pick apples

Title Description

Tao Tao family's yard has an apple tree, every autumn tree will bear 10 apples. Apple ripe, Tao Tao will go apple-picking. Tao Tao has a 30 cm high bench, when she can not directly hand to pick apples and they will try again stepped on the bench.

Now known 10 apples to the ground level, and Tao Tao handle straight time to reach the maximum height, Tao Tao please help her to count the number of apples to pick. Assuming that she met apples, apple will fall.

Input Format

Input data consists of two lines. The first row contains 10 th 100 to 200 between (including 100 and 200 integers) (in centimeters), respectively 10 apples to the ground level, separated by a space between two adjacent integers. The second row includes only a 100 to 120 between (containing 100 and 120 integer) (in centimeters), the maximum height of Toto represents straight when the handle can be achieved.

Output Format

Including output line, which contains only an integer representing the number of Toto able to pick apples.

Sample input and output

Input # 1
100 200 150 140 129 134 167 198 200 111
110
Output # 1
5
 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     int i,a[10],b,ans=0;
 6      for(i=0;i<10;i++){
 7          cin>>a[i];
 8      }
 9      cin>>b;
10      b=b+30;
11      for(i=0;i<10;i++){
12          if(a[i]<=b)ans=ans+1 ;
13       }
 14       cout << years;
15 }

 

Guess you like

Origin www.cnblogs.com/anbujingying/p/11293662.html