#C7791. Counting Consecutive Increasing Sequences
Counting Consecutive Increasing Sequences
Counting Consecutive Increasing Sequences
Given a sequence of integers and an integer k, your task is to count the number of consecutive sub-sequences of length k that are strictly increasing.
A sub-sequence of length k is considered strictly increasing if each element is less than its succeeding element. Formally, for a sub-sequence ai, ai+1, ..., ai+k-1, the condition to be satisfied is:
\[ a_i < a_{i+1} < \cdots < a_{i+k-1} \]Your solution should read the input from stdin and output the result to stdout.
inputFormat
The input consists of two lines:
- The first line contains two space-separated integers: n (the number of elements in the sequence) and k (the length of the subsequence to consider).
- The second line contains n space-separated integers representing the sequence.
outputFormat
Output a single integer representing the number of consecutive sub-sequences of length k that are strictly increasing.
## sample5 3
1 2 3 4 5
3