#P1046. Apple Picking Challenge

    ID: 12470 Type: Default 1000ms 256MiB

Apple Picking Challenge

Apple Picking Challenge

TaoTao has an apple tree in her yard which bears \(10\) apples every autumn. When the apples mature, she rushes to pick them. However, the apples hang at different heights above the ground. TaoTao can extend her hand to a maximum height given in the input. If she cannot directly reach an apple, she will stand on a stool that is \(30\) cm high and try again. An apple is considered picked if TaoTao can touch it (either with her bare hand or by using the stool), and when she touches an apple, it falls to the ground.

Given the heights of the \(10\) apples from the ground and the maximum height TaoTao can reach with her hand, calculate how many apples she will be able to pick. Note that when using the stool, her effective reach increases by \(30\) cm (i.e. her reach becomes \(\text{hand reach} + 30\)).

inputFormat

The input consists of two lines:

  1. The first line contains \(10\) space-separated integers representing the heights (in cm) of the apples from the ground.
  2. The second line contains one integer representing the maximum height (in cm) TaoTao can reach with her hand.

outputFormat

Output a single integer representing the number of apples that TaoTao can pick (i.e., the number of apples with a height less than or equal to \(\text{hand reach} + 30\)).

sample

10 20 30 40 50 60 70 80 90 100
50
8