You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.
A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
InputThe first line contains single positive integer n (1 ≤ n ≤ 105) — the number of integers.
The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).
OutputPrint the maximum length of an increasing subarray of the given array.
Example Input 5 1 7 2 11 15 Output 3 Input 6 100 100 100 100 100 100 Output 1 Input 3 1 2 3 Output 3 这道题只需要记录前一个数字和当前数字,是不是保持一种增加的关系,就好了,因为他要相邻。 #include <iostream> #include<stdio.h> #include<string.h> #include<algorithm> #define INF 0x3f3f3f3f using namespace std; const int maxn=1e5+10; int val[maxn]; int dp[maxn]; int main() { int n; scanf("%d",&n); int ans=0; for(int i=1;i<=n;i++) { dp[i]=1; scanf("%d",&val[i]); if(i!=1) dp[i]=val[i]>val[i-1]?dp[i-1]+1:dp[i]; ans=max(ans,dp[i]); } printf("%d\n",ans); return 0; }