Title DescriptionThere is an apple tree in the description 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.
input/output format input/output
Input Format:
The input file apple.in includes 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.
output Format:
The output file Apple.out includes a row that contains only an integer that represents the number of apples that Tata can pick up.
input and Output sample sample Input/output
sample Test point # #
Input Sample:
100 200 150 140 129 134 167 198 200 111
110
Sample output:
5
DescriptionThe first problem of descriptionNOIP2005 popularization group
Idea: The problem is very simple, is to send the sub-problem, the Tata hand straight when the maximum height can be reached with the bench height after the height of each apple with the judge, if greater than or equal to, counter + +.
The code is as follows:
1#include <stdio.h>2 intMain ()3 { 4 inta[Ten]; 5 inti;6 intb//Tata the maximum height to reach when the hand is stretched7 intToto//counter8 for(i=0;i<Ten; i++) 9 { Tenscanf"%d",&A[i]); One } Ascanf"%d",&b); -b=b+ -; - for(i=0;i<Ten; i++) the { - if(B>=a[i]) toto++; - } -printf"%d\n", Toto); + return 0; -}
Rokua-Tata picking apples-arrays