Codeforces 580A Kefa and First Steps
来源:互联网 发布:淘宝日本代购店推荐 编辑:程序博客网 时间:2024/06/05 17:09
题意:
求最长上升子段(连续的)。
思路:
枚举,维护最长长度。
#include<cstdio>#include<algorithm>using namespace std;const int MAX=100005;int n,a[MAX];int main(){scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&a[i]);}int ans=1,len=1;for(int i=2;i<=n;i++){if(a[i]>=a[i-1]) len++;else len=1;ans=max(ans,len);}printf("%d\n",ans);return 0;}
0 0
- CodeForces 580A Kefa and First Steps
- Codeforces 580A Kefa and First Steps
- Codeforces-580A-Kefa and First Steps
- CodeForces 580A Kefa and First Steps
- codeforces 580A Kefa and First Steps
- codeforces 580A Kefa and First Steps
- codeforces 580A(Kefa and First Steps) Java
- coderforce 580A Kefa and First Steps
- Codeforces Kefa and First Steps
- A. Kefa and First Steps
- Codeforces Round #321 (Div. 2) A. Kefa and First Steps
- Codeforces Round #321 (Div. 2) A. Kefa and First Steps
- Codeforces Round #321 A Kefa and First Steps
- Codeforces Round #321 (Div. 2) 580A Kefa and First Steps(模拟)
- 580A. Kefa and First Steps (Codeforces Round #321 (Div. 2))
- Codeforces Round #321 (Div. 2) 580A. Kefa and First Steps
- Code Forces 580 A. Kefa and First Steps(水~)
- Kefa and First Steps
- Apache修改默认站点目录和虚拟主机配置
- data 目录没有 解决办法
- ios - 调整button内部控件位置
- 华为OJ——矩阵乘法
- scanf,gets,getchar,fgets中的一些细节
- Codeforces 580A Kefa and First Steps
- Leetcode 93. Restore IP Addresses IP地址恢复 解题报告
- 关于二叉树的常见题型
- web 问题
- 《leetCode》:Different Ways to Add Parentheses
- 假设某棵二叉查找树的所有键均为1到10的整数,现在我们要查找5。下面____不可能是键的检查序列。
- 安卓项目之淘忆1.0版本的简述
- 华为OJ——矩阵乘法计算量估算
- 89. Gray Code