580A - Kefa and First Steps

思路:dp

dp[i]表示包括前i个元素中a[i]在内的最大增序列。

代码:

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+;
int a[N];
int dp[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n;
cin>>n;
dp[]=;
int ans=;
for(int i=;i<n;i++)cin>>a[i];
for(int i=;i<n;i++)
{
if(a[i]>=a[i-])dp[i]=dp[i-]+;
else dp[i]=;
ans=max(dp[i],ans);
}
cout<<ans<<endl;
return ;
}

Codeforces 580A - Kefa and First Steps的更多相关文章

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

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

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

  4. codeforces水题100道 第十四题 Codeforces Round #321 (Div. 2) A. Kefa and First Steps (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/580/A题意:求最长连续非降子序列的长度.C++代码: #include <iostream ...

  5. Codeforces Round #321 (Div. 2) Kefa and First Steps 模拟

    原题连接:http://codeforces.com/contest/580/problem/A 题意: 给你一个序列,问你最长不降子串是多长? 题解: 直接模拟就好了 代码: #include< ...

  6. codeforces 580C Kefa and Park(DFS)

    题目链接:http://codeforces.com/contest/580/problem/C #include<cstdio> #include<vector> #incl ...

  7. Codeforces 805D - Minimum number of steps

    805D - Minimum number of steps 思路:简单模拟,a每穿过后面一个b,b的个数+1,当这个a穿到最后,相当于把它后面的b的个数翻倍.每个a到达最后的步数相当于这个a与它后面 ...

  8. Codeforces 580D Kefa and Dishes(状态压缩DP)

    题目链接:http://codeforces.com/problemset/problem/580/D 题目大意:有n盘菜每个菜都有一个满意度,k个规则,每个规则由x y c组成,表示如果再y之前吃x ...

  9. 线段树 + 字符串Hash - Codeforces 580E Kefa and Watch

    Kefa and Watch Problem's Link Mean: 给你一个长度为n的字符串s,有两种操作: 1 L R C : 把s[l,r]全部变为c; 2 L R d : 询问s[l,r]是 ...

随机推荐

  1. Java缓存学习之六:Spring单独使用EhCache

      通过在Application Context中配置EhCacheManagerFactoryBean和EhCacheFactoryBean,我们就可以把对应的EhCache的CacheManage ...

  2. python excel操作 练习-#操作单列 #操作A到C列 #操作1到3行 #指定一个范围遍历所有行和列 #获取所有行 #获取所有列

    ##操作单列#操作A到C列#操作1到3行#指定一个范围遍历所有行和列#获取所有行#获取所有列 #coding=utf-8 from openpyxl import Workbook wb=Workbo ...

  3. OGNL mybatis

    http://www.mybatis.org/mybatis-3/zh/dynamic-sql.html 动态 SQL MyBatis 的强大特性之一便是它的动态 SQL.如果你有使用 JDBC 或其 ...

  4. centos 网卡配置

    地址:/etc/sysconfig/network-scripts vi  /etc/sysconfig/network-scripts/ifcfg-eth0 1.固定ip配置 DEVICE=eth0 ...

  5. 谷歌笔试题--给定一个集合A=[0,1,3,8](该集合中的元素都是在0,9之间的数字,但未必全部包含), 指定任意一个正整数K,请用A中的元素组成一个大于K的最小正整数。

    谷歌笔试题--给定一个集合A=[0,1,3,8](该集合中的元素都是在0,9之间的数字,但未必全部包含), 指定任意一个正整数K,请用A中的元素组成一个大于K的最小正整数. Google2009华南地 ...

  6. (七)git分支的操作

    1.git branch——显示分支一览表 2.git checkout -b——创建.切换分支 往feature-A中不断add.commit叫培育分支 git checkout - 切回上一个分支 ...

  7. jdbc连接池c3p0/dbcp强制连接超过设置时间后失效

    通常来说,各种技术实现的优化参数或者选项或者歪门邪道之所以能被想出来,通常是因为开发者或者实现的贡献者曾经遇到过导致此结果的问题,所以才出了对应的策略选项. 在有些情况下,比如存在客户端或者服务端连接 ...

  8. mysql主备切换[高可用]

    到这一步的时候, 是主备部署已经处理好, 请关注:mysql主备部署[高可用] 这次使用的是keepalived-1.2.22.tar.gz版, 官网地址:keeplived官网 笼统知识请自行查询百 ...

  9. cogs 1962. [HAOI2015]树上染色

    ★★☆   输入文件:haoi2015_t1.in   输出文件:haoi2015_t1.out   简单对比 时间限制:1 s   内存限制:256 MB [题目描述] 有一棵点数为N的树,树边有边 ...

  10. I2C总线信号时序总结【转】

    本文转载自:https://i.cnblogs.com/EditPosts.aspx?opt=1 I2C总线信号时序总结 总线空闲状态  I2C总线总线的SDA和SCL两条信号线同时处于高电平时,规定 ...