Educational Codeforces Round 15 A dp
1 second
256 megabytes
standard input
standard output
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.
A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
The first line contains single positive integer n (1 ≤ n ≤ 105) — the number of integers.
The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).
Print the maximum length of an increasing subarray of the given array.
5
1 7 2 11 15
3
6
100 100 100 100 100 100
1
3
1 2 3
3 题意:连续的最长上升子序列的长度
题解:dp[i]表示以a[i]结尾的 连续的最长上升子序列的长度
/******************************
code by drizzle
blog: www.cnblogs.com/hsd-/
^ ^ ^ ^
O O
******************************/
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<algorithm>
#include<queue>
#include<cmath>
#define ll __int64
#define PI acos(-1.0)
#define mod 1000000007
using namespace std;
int n;
int a[];
int dp[];
int ans=;
int main()
{
scanf("%d",&n);
int ans=;
for(int i=;i<=n;i++)
scanf("%d",&a[i]);
dp[]=;
ans=;
for(int i=;i<=n;i++)
{
if(a[i]>a[i-])
{
dp[i]=dp[i-]+;
ans=max(ans,dp[i]);
}
else
dp[i]=;
}
cout<<ans<<endl;
return ;
}
Educational Codeforces Round 15 A dp的更多相关文章
- Educational Codeforces Round 26 D dp
D. Round Subset time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- codeforces Educational Codeforces Round 16-E(DP)
题目链接:http://codeforces.com/contest/710/problem/E 题意:开始文本为空,可以选择话费时间x输入或删除一个字符,也可以选择复制并粘贴一串字符(即长度变为两倍 ...
- Codeforces Educational Codeforces Round 15 C. Cellular Network
C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Educational Codeforces Round 15 A. Maximum Increase
A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Educational Codeforces Round 60 D dp + 矩阵快速幂
https://codeforces.com/contest/1117/problem/D 题意 有n个特殊宝石(n<=1e18),每个特殊宝石可以分解成m个普通宝石(m<=100),问组 ...
- Educational Codeforces Round 15 C. Cellular Network(二分)
C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
- Educational Codeforces Round 15 C 二分
C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Educational Codeforces Round 15 E - Analysis of Pathes in Functional Graph
E. Analysis of Pathes in Functional Graph time limit per test 2 seconds memory limit per test 512 me ...
- Codeforces Educational Codeforces Round 15 D. Road to Post Office
D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standa ...
随机推荐
- js基础之动画(一)
一.让div动起来 var oBtn = document.getElementById('btn1'); var timer='';//设置定时器 oBtn.onclick=function st ...
- ASP.NET MVC过滤器(一)
MVC过滤器是加在 Controller 或 Action 上的一种 Attribute,通过过滤器,MVC 网站在处理用户请求时,可以处理一些附加的操作,如:用户权限验证.系统日志.异常处理.缓存等 ...
- 在phpmyadmin中执行sql语句出现的错误:Unknown storage engine 'InnoDB'
在phpmyadmin中执行sql语句出现的错误:Unknown storage engine 'InnoDB' 解决方法:解决方法: 1.关闭MySQL数据库 2 ...
- EditorLineEnds.ttr 错误问题
安装 Windows Write Live,在线安装,会先安装一个什么补丁,中途提示失败. 运行Delphi2007,第一次成功,第二次就是 EditorLineEnds.ttr文件错误. http: ...
- mysql 启动错误1026
进入“事件查看器”“应用程序”果然发现很多MySql的错误Default storage engine (InnoDB) is not available 于是进入MySql的安装目录找到my.ini ...
- 为什么要进行傅立叶变换?傅立叶变换究竟有何意义?如何用Matlab实现快速傅立叶变换
写在最前面:本文是我阅读了多篇相关文章后对它们进行分析重组整合而得,绝大部分内容非我所原创.在此向多位原创作者致敬!!!一.傅立叶变换的由来关于傅立叶变换,无论是书本还是在网上可以很容易找到关于傅立叶 ...
- PowerShell并发控制-命令行参数之四问
传教士问: win下如何 获取进程命令行,及命令行参数? 传教士答: 可以用这个powershell命令(实际上是wmi查询): (get-wmiobject -query "select ...
- Xceed WPF 主题皮肤控件Xceed Professional Themes for WPF详细介绍
Xceed Professional Themes for WPF是一款为你的整个应用程序提供完美WPF主题风格的控件,包含Office 2007和Windows 7,可以应用到任何微软官方的WPF控 ...
- 宏定义#define和typedef的区别和典型范例题目辨析
宏定义#define pStr char* ,是直接把程序中出现pStr的地方替换成char* ,直接替换: typedef char * pStr; 是给char*定义一个别名叫做 pStr; ...
- 记录一些容易忘记的属性 -- UIView
一个视图原来添加在某个父视图上,然后再将它添加到另外的一个视图上,这个视图会从原来的某个父视图中移除,添加到新的视图上. 子视图对象指针存在父视图的subviews数组中,说明,一个视图可以有多个子视 ...