CF580A.Kefa and First Steps

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 a__i money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence a__i. 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!

基法决定在互联网上经商,恰好持续 nn 天。他已知第 ii 天(1≤i≤n1 \le i \le n)的收入为 aia_i。基法热爱进步,因此他想了解序列 aia_i 中最长非递减子段的长度。需要提醒的是:序列的子段指的是其连续的一段。若一个数字子段中所有数字均按非递减顺序排列,则称该子段为非递减子段。

请帮助基法完成这项任务!

输入格式

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

The second line contains n integers _a_1,  _a_2,  ...,  a__n (1 ≤ a__i ≤ 109).

第一行包含一个整数 nn(1≤n≤1051 \leq n \leq 10^5)。

第二行包含 nn 个整数 a1, a2, …, ana_1,\ a_2,\ \dots,\ a_n(1≤ai≤1091 \leq a_i \leq 10^9)。

输出格式

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

输出一个整数——序列 aa 的最长非递减子段的长度。

输入输出样例

  • 输入#1

    6
    2 2 1 3 4 1

    输出#1

    3
  • 输入#2

    3
    2 2 9

    输出#2

    3

说明/提示

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.

在第一个测试中,最长的非递减子段是从第三个数到第五个数。

在第二个测试中,最长的非递减子段是从第一个数到第三个数。

输入解题思路,AI测评打分。不知道怎么写?

首页