codeforces 702A A. Maximum Increase(水题)
题目链接:
A. Maximum Increase
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.
51 7 2 11 15
3
6100 100 100 100 100 100
1
31 2 3
3 题意: 求最长的上升子串; 思路: 水题; AC代码:
/************************************************
┆ ┏┓ ┏┓ ┆
┆┏┛┻━━━┛┻┓ ┆
┆┃ ┃ ┆
┆┃ ━ ┃ ┆
┆┃ ┳┛ ┗┳ ┃ ┆
┆┃ ┃ ┆
┆┃ ┻ ┃ ┆
┆┗━┓ ┏━┛ ┆
┆ ┃ ┃ ┆
┆ ┃ ┗━━━┓ ┆
┆ ┃ AC代马 ┣┓┆
┆ ┃ ┏┛┆
┆ ┗┓┓┏━┳┓┏┛ ┆
┆ ┃┫┫ ┃┫┫ ┆
┆ ┗┻┛ ┗┻┛ ┆
************************************************ */ #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <bits/stdc++.h>
#include <stack>using namespace std;#define For(i,j,n) for(int i=j;i<=n;i++)
#define mst(ss,b) memset(ss,b,sizeof(ss));typedef long long LL;template<class T> void read(T&num) {char CH; bool F=false;for(CH=getchar();CH<'0'||CH>'9';F= CH=='-',CH=getchar());for(num=0;CH>='0'&&CH<='9';num=num*10+CH-'0',CH=getchar());F && (num=-num);
}
int stk[70], tp;
template<class T> inline void print(T p) {if(!p) { puts("0"); return; }while(p) stk[++ tp] = p%10, p/=10;while(tp) putchar(stk[tp--] + '0');putchar('\n');
}const LL mod=1e9+7;
const double PI=acos(-1.0);
const int inf=1e9;
const int N=1e5+10;
const int maxn=(1<<8);
const double eps=1e-8;int a[N],g[N],d[N];
int main()
{ int n;read(n);For(i,1,n)read(a[i]);int ans=1,temp=1;For(i,2,n){if(a[i]>a[i-1])temp++;else {ans=max(ans,temp);temp=1;}}ans=max(ans,temp);/*For(i,1,n){int k=lower_bound(g+1,g+n+1,a[i])-g;d[i]=k;g[k]=a[i];}cout<<d[n]<<endl;*/cout<<ans<<endl;return 0;
}
转载于:https://www.cnblogs.com/zhangchengc919/p/5720262.html
codeforces 702A A. Maximum Increase(水题)相关推荐
- Codeforces 864 A Fair Game 水题
题目链接: http://codeforces.com/problemset/problem/864/A 题目描述: 看不是是不是一串数中只有两种数且这两种数字的数量是相同的 解题思路: 水题, 水过 ...
- 【CodeForces - 569B】Inventory (水题)
题干: Companies always have a lot of equipment, furniture and other things. All of them should be trac ...
- CodeForces - 1141D Colored Boots(暴力+水题)
题目链接:点击查看 题目大意:给出两个字符串s和t,两个字符串中相同的字母可以匹配,问号可以和任意字符匹配,现在问两个字符串最多能匹配多少个字符,并给出匹配的下标 题目分析:挺好玩的一道水题,大体思路 ...
- Codeforces gym 100685 C. Cinderella 水题
C. Cinderella Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/ ...
- codeforces 667A A. Pouring Rain(水题)
题目链接: A. Pouring Rain time limit per test 1 second memory limit per test 256 megabytes input standar ...
- 【CodeForces - 485A】Factory (水题,抽屉原理,tricks)
题干: One industrial factory is reforming working plan. The director suggested to set a mythical detai ...
- CodeForces - 25A IQ test【水题】
题目链接:https://codeforces.com/contest/25/problem/A #include <iostream> using namespace std; int ...
- 【Educational Codeforces Round 6A】【水题】Professor GukiZ's Robot 曼哈顿距离
A. Professor GukiZ's Robot time limit per test 0.5 seconds memory limit per test 256 megabytes input ...
- CodeForces - 29A Spit Problem【水题】
题目链接:https://codeforces.com/contest/29/problem/A #include <iostream> #include <cstdio> # ...
最新文章
- 谈谈一些有趣的CSS题目(五)-- 单行居中,两行居左,超过两行省略
- linux读写usb host,LINUX下USB1.1设备学习小记(3)_host与device
- 计算机分类及在信息社会中的应用,計算机在信息社会中的应用.doc
- 本田da屏怎么进wince系统_本田新XR-V首试:配置提升,依然好开
- GeoServer服务器环境的搭建
- 《Linux嵌入式实时应用开发实战(原书第3版)》—2.2 硬件需求
- 【水果识别】基于matlab PCA苹果酸甜度识别【含Matlab源码 1634期】
- object-c的继承
- 数据结构系列之大话数据结构
- gan处理自己的数据集_数据集难找?GAN生成你想要的数据!!!
- 最值得看的文章之一:林锐《大学十年》
- 深度强化学习训练调参方法
- 优秀课件笔记之视听巧记汉英成语2
- 图文对齐居中的几种方式
- 关于C语言中的宏的一点点讨论
- 行内元素设置margin:0 auto无效的问题
- nodejs中解决发出响应数据正常但是浏览器没有正确显示的问题
- 职场邮件的十大忌讳,你犯了吗?
- 手机传感器的意义:未来生活将被彻底改变
- DevOps 一篇入门介绍