Codeforces Round #321 (Div. 2) Kefa and First Steps 模拟
原题连接:http://codeforces.com/contest/580/problem/A
题意:
给你一个序列,问你最长不降子串是多长?
题解:
直接模拟就好了
代码:
#include<iostream>
using namespace std; int n; int main() {
cin.sync_with_stdio(false);
cin >> n;
int p;
cin >> p;
if (n == ) {
cout << << endl;
return ;
}
int maxLen = ;
int now = ;
for (int i = ; i < n; i++) {
int a;
cin >> a;
if (a >= p) {
now++;
maxLen = max(maxLen, now);
}
else {
maxLen = max(maxLen, now);
now = ;
}
p = a;
}
cout << max(now, maxLen) << endl;
return ;
}
Codeforces Round #321 (Div. 2) Kefa and First Steps 模拟的更多相关文章
- Codeforces Round #321 (Div. 2) Kefa and Dishes 状压+spfa
原题链接:http://codeforces.com/contest/580/problem/D 题意: 给你一些一个有向图,求不超过m步的情况下,能获得的最大权值和是多少,点不能重复走. 题解: 令 ...
- Codeforces Round #321 (Div. 2) Kefa and Company 二分
原题链接:http://codeforces.com/contest/580/problem/B 题意: 给你一个集合,集合中的每个元素有两个属性,$m_i,s_i$,让你求个子集合,使得集合中的最大 ...
- Codeforces Round #321 (Div. 2) Kefa and Park 深搜
原题链接: 题意: 给你一棵有根树,某些节点的权值是1,其他的是0,问你从根到叶子节点的权值和不超过m的路径有多少条. 题解: 直接dfs一下就好了. 代码: #include<iostream ...
- Codeforces Round #367 (Div. 2) B. Interesting drink (模拟)
Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to res ...
- 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 ...
- 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 ...
- 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 ...
- Codeforces Round #321 (Div. 2) A, B, C, D, E
580A. Kefa and First Steps 题目链接: A. Kefa and First Steps 题意描述: 给出一个序列,求最长不降连续子序列多长? 解题思路: 水题,签到 代码: ...
- Codeforces Round #321 (Div. 2)
水 A - Kefa and First Steps /************************************************ * Author :Running_Time ...
随机推荐
- java上传附件,批量下载附件(一)
上传附件代码:借助commons-fileupload-1.2.jar package com.str; import java.io.BufferedInputStream;import java. ...
- Python中关于函数的介绍
一.什么是函数 当我们在日常工作中编写代码时,有没有发现这种情况,写了一套代码,却发现里面有很多段代码出现了有规律的重复,这样就不符合一个合格程序员的标准了,一个合格的程序员编写的代码最重 ...
- selection problem-divide and conquer
思路: 随机选取列表中的一个值v,然后将列表分为小于v的,等于v的,大于v的三组.对于k<=left.size()时, 在left中执行selection:落在中间的,返回v:k>left ...
- Linux学习-备份要点
备份资料的考虑 老实说,备份是系统损毁时等待救援的救星!因为你需要重新安装系统时, 备份的好坏会影响到你 系统复原的进度!事实上,系统有可能由于不预期的伤害而导致系统发生错误! 什么是不预期的伤害呢? ...
- selenium2截图ScreenShot的使用
截图是做测试的基本技能,在有BUG的地方,截个图,保留失败的证据,也方便去重现BUG.所以,在自动化的过程中,也要能截图,也要能在我们想要截取的地方去截图,且能在错误产生时,自动的截图. 示例: 脚本 ...
- provider:命名管道提供程序,error:40 - 无法打开到SQL Server的连接 (Microsoft
最近一直在配置服务器, 这当中最头疼的就是配置数据库 我们用的是SQL Server 数据库 2008 版本,数据库配置完之后从另一台电脑访问数据库死活连接不上,提示信息如下 " 无法连接到 ...
- LiveScript 流程控制、循环以及列表推导式
The LiveScript Book The LiveScript Book Generators and Yield 你可以在你的 LiveScript 代码中使用 Ecmascript ...
- [办公软件篇][2]source-insight安装
http://jingyan.baidu.com/article/a3f121e4fe173ffc9052bbb0.html 注意看:同步代码
- Vijos1512 SuperBrother打鼹鼠
SuperBrother打鼹鼠 Vijos链接 题目描述: 在一个矩阵中,有三种操作: 1.后面跟着3个数x,y,k,表示在点(x,y)处新出现了k只鼹鼠. 2.后面跟着4个数x1,y1,x2,y2, ...
- 【Luogu】P2602数字计数(数位DP)
题目链接 数位DP好喵啊.自己yy两个小时的dfs:题解40行代码=10WA:10A. md而且还不是完全理解题解是什么意思. 所以放题解链接. #include<cstdio> #inc ...