#K4306. Counting Plant Growth Days
Counting Plant Growth Days
Counting Plant Growth Days
In this problem, you are given a sequence of plant heights recorded over consecutive days. Your task is to determine the number of days on which the plant exhibited growth compared to the previous day. Mathematically, for an array of heights ( h_1, h_2, \dots, h_n ), count the number of indices ( i ) (with ( 2 \leq i \leq n )) such that ( h_i > h_{i-1} ).
This problem tests your ability to iterate through an array and compare adjacent elements. Read the input from standard input and write the result to standard output.
inputFormat
The input is read from standard input (stdin). The first line contains an integer ( n ), representing the number of days. The second line contains ( n ) space-separated integers, where the ( i^{th} ) integer represents the height of the plant on the ( i^{th} ) day.
outputFormat
Output a single integer to standard output (stdout) which is the number of days in which the plant’s height increased compared to the previous day.## sample
5
1 2 2 3 5
3