原题连接: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 模拟的更多相关文章

  1. Codeforces Round #321 (Div. 2) Kefa and Dishes 状压+spfa

    原题链接:http://codeforces.com/contest/580/problem/D 题意: 给你一些一个有向图,求不超过m步的情况下,能获得的最大权值和是多少,点不能重复走. 题解: 令 ...

  2. Codeforces Round #321 (Div. 2) Kefa and Company 二分

    原题链接:http://codeforces.com/contest/580/problem/B 题意: 给你一个集合,集合中的每个元素有两个属性,$m_i,s_i$,让你求个子集合,使得集合中的最大 ...

  3. Codeforces Round #321 (Div. 2) Kefa and Park 深搜

    原题链接: 题意: 给你一棵有根树,某些节点的权值是1,其他的是0,问你从根到叶子节点的权值和不超过m的路径有多少条. 题解: 直接dfs一下就好了. 代码: #include<iostream ...

  4. Codeforces Round #367 (Div. 2) B. Interesting drink (模拟)

    Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to res ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

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

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

  9. Codeforces Round #321 (Div. 2)

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

随机推荐

  1. 大意了,这几道Python面试题没有答对,Python面试题No13

    第1题: Python如何爬取 HTTPS 网站? 这类问题属于简单类问题 在使用 requests 前加入:requests.packages.urllib3.disable_warnings(). ...

  2. LeetCode(289)Game of Life

    题目 According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cel ...

  3. HDU:1269-迷宫城堡(tarjan模板)

    迷宫城堡 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Descri ...

  4. poj 2676 数独问题 dfs

    题意:完成数独程序,数独要求每行每列且每个3*3矩阵都必须是1~9的数字组成. 思路:dfs 用row[i][n] 记录第i行n存在  用col[j][n] 记录第j列n存在 grid[k][n] 记 ...

  5. Windows清理打印池的方法

    另存为bat运行   @echo off title 快速清除打印队列 echo. echo 停止打印机服务 net stop spooler>nul echo. del /q /f %wind ...

  6. Django基于Pycharm开发之二 [使用django adminSite]

    在使用django自带的adminsite的时候,有以下内容需要做. 1.数据迁移,管理表的创建. 2.启用本地化 (setting.py的配置) 一.数据迁移,默认情况下,安装django之后,dj ...

  7. 关于 NSData 的数据类型(2进制,16进制之间)及深入剖析

    1. NSData 与 NSString NSData-> NSString NSString *aString = [[NSString alloc initWithData:adataenc ...

  8. quarz spring boot

    package com.pkfare.task.manage.config; import org.quartz.spi.TriggerFiredBundle; import org.springfr ...

  9. python基础补漏-09-反射

    isinstance class A: passclass B(A): pass b = B()print isinatance(b,A)issubclass 判断某一个类是不是另外一个类的派生类 # ...

  10. 快速排序-php代码实现

    <?php function quickSort(array &$a) { $n = count($a); quickSortInternally($a, 0, $n-1); } fun ...