Maximum Increase CodeForces
来源:互联网 发布:湖南卫视杜海涛知乎 编辑:程序博客网 时间:2024/06/12 22:47
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 subarraystrictly greater than previous.
The first line contains single positive integer n (1 ≤ n ≤ 105) — the number of integers.
The second line contains n positive integersa1, a2, ..., an (1 ≤ ai ≤ 109).
Print the maximum length of an increasing subarray of the given array.
Input
51 7 2 11 15
Output
3
Input
6100 100 100 100 100 100
Output
1
Input
31 2 3
Output
3
#include <iostream>#include<stdio.h>#include<string.h>#include<algorithm>#define INF 0x3f3f3f3fusing 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;}
阅读全文
0 0
- Maximum Increase CodeForces
- CodeForces 702A Maximum Increase
- codeforces-702A-Maximum Increase
- CodeForces 702A Maximum Increase
- codeforces 702A Maximum Increase
- 【Codeforces】-702A- Maximum Increase(水)
- CodeForces 702A Maximum Increase 水
- CodeForces 702A Maximum Increase (DP)
- Maximum Increase
- A. Maximum Increase
- CF-Educational Codeforces Round 15-A-Maximum Increase
- 【CODEFORCES】 D. Increase Sequence
- Codeforces702A - Maximum Increase【尺取】
- Codeforces 466 D. Increase Sequence
- ACM--Maximum Increase--最长递增数组序列
- Increase and Decrease--codeForces 246B
- 【DP】 codeforces 466D Increase Sequence
- codeforces 466D Increase Sequence DP
- CCF CSP 认证 201612-2 工资计算 java版
- Unity3D学习:结合Kinect进行游戏开发 | 孤舟博客
- idea下使用Maven找不到类
- win32窗口程序 -----1、加载资源图标
- 使用Electron-package打包exe
- Maximum Increase CodeForces
- Android .so文件
- redhat5挂载nas盘报错: reason given by server: Permission denied
- C#中事件处理的个人体会
- Java中的String与intern方法
- 文章标题
- Spring Boot中使用Swagger2构建强大的RESTful API文档
- postgresql无视链接删除数据库
- Unity Shader学习笔记:遮罩纹理