Problem description

Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is its continuous fragment. A subsegment of numbers is called non-decreasing if all numbers in it follow in the non-decreasing order.

Help Kefa cope with this task!

Input

The first line contains integer n (1 ≤ n ≤ 105).

The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).

Output

Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.

Examples

Input

6
2 2 1 3 4 1

Output

3

Input

3
2 2 9

Output

3

Note

In the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.

In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.

解题思路:求最大非递减序列的长度,注意maxlen初始值为1,水过!

AC代码:

 #include<bits/stdc++.h>
using namespace std;
int n,len=,maxlen=,a[];
int main(){
cin>>n;
for(int i=;i<n;++i)cin>>a[i];
for(int i=;i<n;++i){
if(a[i]>=a[i-])len++;
else len=;
maxlen=max(maxlen,len);
}
cout<<maxlen<<endl;
return ;
}

A - Kefa and First Steps的更多相关文章

  1. Codeforces Round #321 (Div. 2) A. Kefa and First Steps 水题

    A. Kefa and First Steps Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/58 ...

  2. Codeforces 580A - Kefa and First Steps

    580A - Kefa and First Steps 思路:dp dp[i]表示包括前i个元素中a[i]在内的最大增序列. 代码: #include<bits/stdc++.h> usi ...

  3. Codeforces Round #321 (Div. 2) A. Kefa and First Steps【暴力/dp/最长不递减子序列】

    A. Kefa and First Steps time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  4. Codeforces Round #321 (Div. 2)-A. Kefa and First Steps,暴力水过~~

    A. Kefa and First Steps time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  5. codeforces水题100道 第十四题 Codeforces Round #321 (Div. 2) A. Kefa and First Steps (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/580/A题意:求最长连续非降子序列的长度.C++代码: #include <iostream ...

  6. Codeforces Round #321 (Div. 2) Kefa and First Steps 模拟

    原题连接:http://codeforces.com/contest/580/problem/A 题意: 给你一个序列,问你最长不降子串是多长? 题解: 直接模拟就好了 代码: #include< ...

  7. Codeforces Round #321 (Div. 2) A, B, C, D, E

    580A. Kefa and First Steps 题目链接: A. Kefa and First Steps 题意描述: 给出一个序列,求最长不降连续子序列多长? 解题思路: 水题,签到 代码: ...

  8. Codeforces Round #321 (Div. 2)

    水 A - Kefa and First Steps /************************************************ * Author :Running_Time ...

  9. animation-timing-function: steps() 详解

    在应用 CSS3 渐变/动画时,有个控制时间的属性 <animation-timing-function> .它的取值中除了常用到的 贝萨尔曲线以外,还有个让人比较困惑的 steps()  ...

随机推荐

  1. Linux学习自动化脚本(一)

    https://www.cnblogs.com/handsomecui/p/5869361.html https://blog.csdn.net/daigualu/article/details/76 ...

  2. structure vs class in swift language

    Both class and structure can do: Define properties to store values Define methods to provide functio ...

  3. Ubuntu 更换阿里源

    查看新版本信息 lsb_release -c Ubuntu 12.04 (LTS)代号为precise. Ubuntu 14.04 (LTS)代号为trusty. Ubuntu 15.04 代号为vi ...

  4. BZOJ 4195: [Noi2015]程序自动分析 并查集 + 离散化 + 水题

    TM 读错题了...... 我还以为是要动态询问呢,结果是统一处理完了再询问...... 幼儿园题,不解释. Code: #include<bits/stdc++.h> #define m ...

  5. 【第二课】kaggle案例分析二

    Evernote Export 推荐系统比赛(常见比赛) 推荐系统分类 最能变现的机器学习应用 基于应用领域分类:电子商务推荐,社交好友推荐,搜索引擎推荐,信息内容推荐等 **基于设计思想:**基于协 ...

  6. Windows下Jupyter notebook 修改默认打开(工作、保存)文件夹(路径)

    今天晚上兴致一起突然想看看我写了那么多的ipynb文件都去哪了 首先查了一下,应该是都默认保存到    C:\Users\芩溪儿   路径下了 然后我就想,我是不是得改改啊,总在那跟别的文件夹在一起总 ...

  7. svn版本库更新后自动同步到www

    注意:www目录一定要用SVN服务器 checkout出Repositories的代码 步骤: (1)新建www根目录 mkdir -p /data/www/lehuo (2)在www根目录下检出(c ...

  8. Git 基础教程 之 分支管理及策略

    创建一个属于自己的分支,别人看不到,你在你自己的分支上干活, 想提交就提交,直至开发完毕后,再一次性合并到原来分支上.这样,既安全,又不影响他人工作.          在实际的开发过程中,应照几个基 ...

  9. 9.在idea中创建Maven项目

    1.新建maven WEB项目 打开-File-New-Project 点击NEXT 2.选择项目组,并给项目命名 3.选择maven路径 添加的配置为 archetypeCatalog=intern ...

  10. [bzoj1180][CROATIAN2009]OTOCI_LCT

    OTOCI bzoj-1180 CROATIAN-2009 题目大意:给你n个离散的点,m个操作.支持:两点加边(保证还是森林),修改单点权值,询问两点是否联通,查询联通两点之间路径权值. 注释:$1 ...