A. Maximum Increase
time limit per test 1 second
memory limit per test 256 megabytes
input standard input
output 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.

Input

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

Output

Print the maximum length of an increasing subarray of the given array.

Examples
input
5
1 7 2 11 15
output
3
input
6
100 100 100 100 100 100
output
1
input
3
1 2 3
output
3

求出最长上升子串长度

真是逗逼。。写了<和>的情况忘记搞=了

然后被x。。

幸好不记分

哎毕竟是老了

 #include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<ctime>
#define LL long long
#define inf 0x7ffffff
#define pa pair<int,int>
#define pi 3.1415926535897932384626433832795028841971
using namespace std;
inline LL read()
{
LL x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline void write(LL a)
{
if (a<){printf("-");a=-a;}
if (a>=)write(a/);
putchar(a%+'');
}
inline void writeln(LL a){write(a);printf("\n");}
int n,x,tot,ans;
int a[];
int main()
{
n=read();
for(int i=;i<=n;i++)a[i]=read();
x=a[];tot=;ans=;
for (int i=;i<=n;i++)
{
if (a[i]>x)x=a[i],tot++;
else if (a[i]<=x)x=a[i],tot=;
ans=max(ans,tot);
}
printf("%d\n",ans);
}

cf702A

cf702A Maximum Increase的更多相关文章

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

  2. codeforces 702A A. Maximum Increase(水题)

    题目链接: A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input sta ...

  3. CodeForces 702 A Maximum Increase (贪心,高效算法)

    题意:给定 n 个数,问你连续的最长的序列是几个. 析:从头扫一遍即可. 代码如下: #include <cstdio> #include <string> #include ...

  4. CodeForces 702A Maximum Increase

    简单$dp$. 如果$a[i]>a[i-1]$,那么$dp[i]=dp[i-1]+1$.否则,$dp[i]=1$.答案为$dp[i]$中的最大值. #pragma comment(linker, ...

  5. Codeforces 702A Maximum Increase(dp)

    题目链接:http://codeforces.com/problemset/problem/702/A 题意: 给你N个数,a[0], a[1], a[2], ....., a[n-1],让你找出最长 ...

  6. Codeforces - 702A - Maximum Increase - 简单dp

    DP的学习计划,刷 https://codeforces.com/problemset?order=BY_RATING_ASC&tags=dp 遇到了这道题 https://codeforce ...

  7. Codeforces702A - Maximum Increase【尺取】

    题意: 求一个连续的最长子序列长度: 思路: 没看仔细还wa1了-以为LIS- 然后写了尺取吧...= =太不仔细了.不过收获是LIS特么写挫了然后看了学长的blog<-点我- 题目的挫code ...

  8. Educational Round 15

    A题Maximum Increase 大水题.最长连续递增子序列有多长. #include <cstdio> #include <algorithm> using namesp ...

  9. Educational Codeforces Round 15 A dp

    A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard ...

随机推荐

  1. Shell - 特殊变量

    $0 表示所执行程序的路径名. [huey@huey-K42JE ~]$ ll ~/bin total 4 -rwxrwxr-x 1 huey huey 21 Oct 24 14:39 hello [ ...

  2. Openblas编译Android NDK库的步骤

    1.配置Android NDK编译工具.以下下载地址,直接放到浏览器中下载,不需要VPNlinux 32 bithttp://dl.google.com/android/ndk/android-ndk ...

  3. Android开发--二维码开发应用(转载!)

    android项目开发 二维码扫描   基于android平台的二维码扫描项目,可以查看结果并且链接网址 工具/原料 zxing eclipse 方法/步骤   首先需要用到google提供的zxin ...

  4. Android Parcelable Trans byte[]

    思路: http://stackoverflow.com/questions/10898116/make-custom-parcelable-containing-byte-array 谢谢, 这位外 ...

  5. socket.io 实例

    //引用 var io = require('socket.io')(server);   //server io.on('connection', function(socket) {     // ...

  6. list-style-type -- 定义列表样式

    取值:disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek ...

  7. MVC埰坑日记 文件权限

    public static void DownLoadFile(string FileFullPath) { if (!string.IsNullOrEmpty(FileFullPath) & ...

  8. [转载]python os.path模块

    os.path模块主要用于文件的属性获取,在编程中经常用到,以下是该模块的几种常用方法.更多的方法可以去查看官方文档:http://docs.python.org/library/os.path.ht ...

  9. 无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型,原因为没有注册类

    错误描述 e = {"无法将类型为"System.__ComObject"的 COM 对象强制转换为接口类型"OpcRcw.Da.IOPCServer" ...

  10. python 图片压缩存储

    python(PIL)图像处理(等比例压缩.裁剪压缩) 缩略(水印)图 http://outofmemory.cn/code-snippet/12264/python-PIL-image-proces ...