Codeforces Round #321 (Div. 2)(A)模拟
来源:互联网 发布:淘宝上面做销售怎么做 编辑:程序博客网 时间:2024/06/06 03:56
题意:求连续最长不下降子序列
题解:直接模拟扫一遍数组就可以了
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#define N int(1e5+5)int a[N];using namespace std;int main(){#ifdef CDZSCfreopen("i.txt", "r",stdin);#endifint n,cas=0;while (~scanf("%d", &n)){for (int i = 0; i < n; i++){scanf("%d", a + i);}int ans=-1,last = 0,num=a[0];for (int i = 0; i < n; i++){if (num <= a[i]){num = a[i];}else{num = a[i];ans = max(i - last, ans);last = i;}}ans = max(n - last,ans);printf("%d\n", ans);}return 0;}
0 0
- Codeforces Round #321 (Div. 2)(A)模拟
- Codeforces Round #346 (Div. 2) -A. Round House(模拟)
- Codeforces Round #297 (Div. 2) A(模拟)
- Codeforces Round #340 (Div. 2)(A) 模拟
- Codeforces Round #107 (Div. 2) A(简单模拟)
- Codeforces Round #109 (Div. 2) A (简单模拟)
- Codeforces Round #281 (Div. 2)A(构造+暴力模拟)
- Codeforces Round #328 (Div. 2)Problem A. PawnChess(模拟)
- Codeforces Round #335 (Div. 2) (A)模拟
- Codeforces Round #341 (Div. 2)(A)模拟
- Codeforces Round #294 (Div. 2)(A)模拟
- Codeforces Round #246 (Div. 2)(A)模拟
- Codeforces Round #247 (Div. 2)(A)模拟
- Codeforces Round #273 (Div. 2)(A)模拟
- Codeforces Round #345 (Div. 2)-A. Joysticks(模拟)
- Codeforces Round #277 (Div. 2)(A)模拟,打表
- Codeforces Round #346 (Div. 2)(A)模拟
- Codeforces Round #349 (Div. 2)(A)模拟
- python 风格指南笔记
- 一个Bootstrap的例子--关于validate
- DDA应用实践-冈萨雷斯《数字图像处理》
- Android 自定义控件 轻松实现360软件详情页
- 广师Android群分享之网络
- Codeforces Round #321 (Div. 2)(A)模拟
- 如何得到Activities栈顶的Activity名称
- 数据挖掘之中文本的表示模型
- 大数据时代,我们应该具有怎样的思维方式?
- 【小镇的技术天梯】Linux内核学习,物理内存
- 广师Android群分享之程序员的鸡汤文章
- Android 打造形形色色的进度条 实现可以如此简单
- linux下如何启动svn教程
- Codeforces Round #321 (Div. 2)(B)尺取+前缀和