#include <stdio.h>
#include <string.h>
#define MAXSIZE 100024//之前数据少开了一个量级

int money[MAXSIZE];

int main()
{
    memset(money, 0, sizeof(money));
    int a;
    scanf("%d", &a);
    int Thiscnt=1, Maxcnt=1;//如果Maxcnt=-1;那么当a为1的时候,for循环不会执行,进而导致输入结果为-1(出错)。
    int i;
    int cnt=0;
    scanf("%d", &money[0]);
    for(i=0; i<(a-1); ++i)
    {
        ++cnt;
        scanf("%d", &money[i+1]);
        //printf("i+1=%d,money[%d]=%d ", i+1, i+1, money[i+1]);
        if(money[i]<=money[i+1]) //a[i];a[i-1] is wrong.money[i-1] is wrong.
        {
            ++Thiscnt;
            //printf("cnt=%d:Thiscnt=%d\n", cnt, Thiscnt);
        }
        else
            Thiscnt=1;
        if(Thiscnt>Maxcnt)
            Maxcnt=Thiscnt;
    }
    printf("%d\n", Maxcnt);
    return 0;
}

  

580A的更多相关文章

  1. Codeforces 580A - Kefa and First Steps

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

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

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

随机推荐

  1. https认证握手过程

  2. [微信小程序] 微信小程序开发初步探索

    1.开发文档 https://developers.weixin.qq.com/miniprogram/dev/ app.json配置:https://developers.weixin.qq.com ...

  3. 利用rqalpha帅选股票 1

    最近股市好了,然后过了3100点后躺着赚钱已经不容易了,股票又太多,想着现在也是做这个东西,倒不如再进一步,把之前研究的量化交易利用起来. rqalpha很早就开源了,之前看过,貌似用来选股什么的很好 ...

  4. SpringMVC+ Mybatis 配置多数据源 + 自动数据源切换 + 实现数据库读写分离

    现在大型的电子商务系统,在数据库层面大都采用读写分离技术,就是一个Master数据库,多个Slave数据库.Master库负责数据更新和实时数据查询,Slave库当然负责非实时数据查询.因为在实际的应 ...

  5. Unable to install SQL Server (setup.exe), VS Shell installation has failed with exit code 1638.

    The problem is likely that there's a newer version of the Visual C++ Redistributable than SQL Server ...

  6. 3 ansible-playbook 条件语句-外部变量使用

    外部变量指的是从playbook文件之外获取的数值 lookups file file是我们经常使用的一种lookups的方式,它的原理就是使用python的codecs.open打开文件然后把结果返 ...

  7. [Ubuntu] Git可视化比较工具 P4Merge 的安装/配置及使用

    1 下载 下载地址. 链接到上面的下载页后,先找到左边导航的 Clients ,如下图 1 所示. 接着找到 P4Merge: Visual Merge Tool , 如下图 2 所示. 最后,选择好 ...

  8. (二)区块链的共识算法:PoS 及其 例子 代码 实现

    作者:林冠宏 / 指尖下的幽灵 掘金:https://juejin.im/user/587f0dfe128fe100570ce2d8 博客:http://www.cnblogs.com/linguan ...

  9. Windows Server2012R2 FTP服务器配置

    转载博客:http://blog.csdn.net/smalllu161226/article/details/53887751 1.打开windows server2012R2 服务器管理器界面 添 ...

  10. maven 私服同步无法获取依赖的pom.xml的依赖

    项目中引入了依赖: <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hado ...