Codeforces 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的更多相关文章
- 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水题100道 第十四题 Codeforces Round #321 (Div. 2) A. Kefa and First Steps (brute force)
题目链接:http://www.codeforces.com/problemset/problem/580/A题意:求最长连续非降子序列的长度.C++代码: #include <iostream ...
- Codeforces Round #321 (Div. 2) Kefa and First Steps 模拟
原题连接:http://codeforces.com/contest/580/problem/A 题意: 给你一个序列,问你最长不降子串是多长? 题解: 直接模拟就好了 代码: #include< ...
- codeforces 580C Kefa and Park(DFS)
题目链接:http://codeforces.com/contest/580/problem/C #include<cstdio> #include<vector> #incl ...
- Codeforces 805D - Minimum number of steps
805D - Minimum number of steps 思路:简单模拟,a每穿过后面一个b,b的个数+1,当这个a穿到最后,相当于把它后面的b的个数翻倍.每个a到达最后的步数相当于这个a与它后面 ...
- Codeforces 580D Kefa and Dishes(状态压缩DP)
题目链接:http://codeforces.com/problemset/problem/580/D 题目大意:有n盘菜每个菜都有一个满意度,k个规则,每个规则由x y c组成,表示如果再y之前吃x ...
- 线段树 + 字符串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]是 ...
随机推荐
- Linux系统——PXE高效能批量网络装机
PXE:Pre-boot Excution Environment,预启动执行环境,石油Intel公司开发的网络引导技术,工作在Client.Server模式,允许客户机通过网络从远程服务器下载阴道镜 ...
- Django初级手册1-项目和应用的创建与简单的数据库操作
创建项目 django-admin.py startproject mysite 1. 目录结构 mysite/ #项目的名称 manage.py #可通过命令和项目进行交互的文件 mysite/ # ...
- 007-配置IP和DNS
2.配置DNS. 3.
- LCD驱动
LCD的驱动情况比较多. 对于一般的LCD,驱动方式有MCU,MPU,SPI等.其中MCU方式不需要输入clk,vsync,hsync等信号.完全可以通过异步来驱动,但是这样难以将屏 幕做到很大.MP ...
- cc150 --链表分割
题目描述 编写代码,以给定值x为基准将链表分割成两部分,所有小于x的结点排在大于或等于x的结点之前 给定一个链表的头指针 ListNode* pHead,请返回重新排列后的链表的头指针.注意:分割以后 ...
- linux导出、导入sql
linux下导入.导出mysql数据库命令 一.导出数据库用mysqldump命令(注意mysql的安装路径,即此命令的路径): 1.导出数据和表结构: mysqldump -u用户名 -p密码 数据 ...
- 20165207 Exp4 恶意代码分析
目录 1.实验内容 1.1.系统运行监控 1.1.1.使用命令行创建计划任务 1.1.2.使用命令行借助批处理文件创建计划任务 1.1.3.分析netstat计划任务的最终结果 1.1.4.安装配置s ...
- AI+教育落地,百度大脑如何让校园更智能?
人工智能作为影响社会底层技术革命逐渐向传统行业渗透,“AI+”已经替代“互联网+”成为创业创新的新引擎,出人意料的是,在AI在教育业的率先落地并且相当火爆. 现在,人工智能教育已成为从业者心目中的“教 ...
- Python学习笔记之@classmethod与@staticmethod
Python面向对象编程中,类中定义的方法可以是 @classmethod 装饰的 类方法 ,也可以是 @staticmethod 装饰的 静态方法 ,用的最多的还是不带装饰器的 实例方法 ,如果把这 ...
- jenkins 安装 + maven + git部署
1. 安装JDK 2. 安装maven 3. 安装git 4. 安装tomcat tar zxvf apache-tomcat-8.5.14.tar.gz 找到tomcat-->config-- ...