#P1046. [NOIP 2005 普及组] 陶陶摘苹果

[NOIP 2005 普及组] 陶陶摘苹果

Description

There is an apple tree in Taotao’s yard. Every autumn the tree bears 1010 apples. When the apples ripen, Taotao goes to pick them. Taotao has a 3030-centimeter-tall stool; when she cannot reach an apple directly with her hand, she will step on the stool and try again.

Now you are given the heights above the ground of the 1010 apples, and the maximum height Taotao can reach when she stretches out her hand. Please help Taotao calculate how many apples she can pick. Assume that if she touches an apple, it will fall.

Input Format

The input consists of two lines of data. The first line contains 1010 integers between 100100 and 200200 inclusive (in centimeters), representing the heights above the ground of the 1010 apples, separated by single spaces. The second line contains a single integer between 100100 and 120120 inclusive (in centimeters), representing the maximum height Taotao can reach when she stretches out her hand.

Output Format

Output a single line containing one integer, which is the number of apples Taotao can pick.

100 200 150 140 129 134 167 198 200 111
110

5

Hint

[Source]

NOIP 2005 Junior, Problem 1.

Translated by ChatGPT 5