原题连接: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日志模块logging的详解 https://www.cnblogs.com/linuxchao/p/linuxchao-log.html, 虽然这篇文章是别人写的 ...

  2. LeetCode(234) Palindrome Linked List

    题目 Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) t ...

  3. RSS列表

    博客园 http://feed.cnblogs.com/blog/sitehome/rss

  4. HT1621控制的段式液晶驱动程序

    MCU是STM8S207 /*LED 字模结构*/ typedef struct { char mChar; u8 mModal; }LED_MODAL_DEFINE; typedef struct ...

  5. CodeForces 519E 树形DP A and B and Lecture Rooms

    给出一棵树,有若干次询问,每次询问距两个点u, v距离相等的点的个数. 情况还挺多的,少侠不妨去看官方题解.^_^ #include <iostream> #include <cst ...

  6. MySQL主从复制(Master-Slave)

    MySQL数据库自身提供的主从复制功能可以方便的实现数据的多处自动备份,实现数据库的拓展.多个数据备份不仅可以加强数据的安全性,通过实现读写分离还能进一步提升数据库的负载性能. 下图就描述了一个多个数 ...

  7. loj2014 「SCOI2016」萌萌哒

    神tm st表+并查集 #include <iostream> #include <cstdio> #include <cmath> using namespace ...

  8. ssh免密码登录远程服务器(不采用securecrt登录)

      http://blog.csdn.net/leexide/article/details/17252369       Linux/UNIX下使用ssh-keygen设置SSH无密码登录 标签:  ...

  9. 刷题总结——运输计划(bzoj4326)

    题目: 题目背景 NOIP2015 提高组 Day2 T3 题目描述 公元2044年,人类进入了宇宙纪元. L国有 n 个星球,还有 n-1 条双向航道,每条航道建立在两个星球之间,这 n-1 条航道 ...

  10. 【CCF】送货 欧拉路径

    80分,暂时没找出20分的Bug #include<iostream> #include<cstdio> #include<cstring> #include< ...