580A
#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的更多相关文章
- Codeforces 580A - Kefa and First Steps
580A - Kefa and First Steps 思路:dp dp[i]表示包括前i个元素中a[i]在内的最大增序列. 代码: #include<bits/stdc++.h> usi ...
- Codeforces Round #321 (Div. 2) A, B, C, D, E
580A. Kefa and First Steps 题目链接: A. Kefa and First Steps 题意描述: 给出一个序列,求最长不降连续子序列多长? 解题思路: 水题,签到 代码: ...
随机推荐
- mongodb配置文件解说(转载)
启动方式 ./bin/mongod -f mongodb.conf 会看到 about to fork child process, waiting until server is ready for ...
- 安全工具-Sparta
Sparta是一个集端口扫描.网络扫描.服务探测以及暴力破解等多项功能于一身的工具,kali中已经预装了该工具,可直接使用. > 输入目标IP,开始扫描即可探测出开放的端口及服务 > 选中 ...
- sed用法去除行首和行末的中括号
sed去掉行首和行末的中括号: sed -i 's:^\[::; s:\]$::;' newtrace_nlp.log.2018-08-02.bak 其余可依次类推.
- [转]spring MultipartFile 转 File
原文地址:https://www.jianshu.com/p/6cf99d39e170 File.createTempFile(String prefix, String suffix); 创建一个临 ...
- jenkins GitHub 自动触发
jenkins GitHub 自动触发 转载请注明出处: 转载自Bin's Blog: jenkins GitHub 自动触发( http://www.wenbin.cf/post/54/ ) 需要 ...
- C语言 goto语句
/* goto语句 */ #include <stdio.h> #include <stdlib.h> #include <string.h> /* goto语句也 ...
- Google API Design Guide (谷歌API设计指南)中文版
面向资源的设计 这份设计指南的目标是帮助开发人员设计简单.一致.易用的网络API.同时,它也有助于收敛基于socket的API和(注:原文是with,这里翻译为“和”)基于HTTP的REST API. ...
- 24小时学通Linux内核之向内核添加代码
睡了个好觉,很晚才起,好久没有这么舒服过了,今天的任务不重,所以压力不大,呵呵,现在的天气真的好冷,不过实验室有空调,我还是喜欢待在这里,有一种不一样的感觉,在写了这么多天之后,自己有些不懂的页渐渐的 ...
- MTK 关闭耳机调至最大音量时,提示损伤听力
android开发之耳机调至最大音量时,提示损伤听力 android开发之耳机调至最大音量时,提示损伤听力 通过提示语,我们可以查出,只要的逻辑代码是在framework/base/packages/ ...
- Linux下的at定时执行任务命令详解
之前说了使用crontab实现定时执行任务,假如我们只是想要让特定任务运行一次,那么,这时候就要用到at监控程序了.一.at服务 cron是一个linux下 的定时执行工具,可以在无需人工干预的情况下 ...