Codeforces Round #321 A Kefa and First Steps
2015-09-23 20:06
302 查看
题意:给你N个数,让你求连续最长不上升子序列的元素个数、
思路:一重for循环,直接模拟,一次过、
AC代码:
思路:一重for循环,直接模拟,一次过、
AC代码:
#include<cstdio> const int maxn=110000; int a[maxn]; int n; int main(){ while(scanf("%d",&n)!=EOF){ for(int i=0;i<n;i++) scanf("%d",&a[i]); int x;int y;int z; x=y=1;z=a[0]; int falg=0; for(int i=1;i<n;i++){ if(a[i]>=z){ z=a[i]; x++; } else{ z=a[i]; if(x>y) y=x; x=1; } } if(x>y) y=x; printf("%d\n",y); } return 0; }
相关文章推荐
- iOS-APP发布应注意
- BaseDao的设计思路---接口编程
- Android自定义软键盘输入法,隐藏系统输入法显示光标的实现
- 优化UITableViewCell高度计算的那些事
- 高效程序员的 7 个共同特征
- poj2187(最远点的距离的平方)
- 使用Android Studio时的一个问题
- iOS-App上架流程
- xml直接读取节点
- 我公司在做什么(“paas平台”)
- Android 5.0新特性ToolBar
- 总要问个为什么?
- hdu 1114--Piggy-Bank(完全背包)
- 第4周—项目4 建立双链表算法库
- Hill密码
- Effective C++——条款53(第9章)
- android可扩展自己的定义,运动图像裁剪框
- Build better apps: Windows 10 by 10 development series
- POJ 2886 线段树
- Java内存管理原理及内存区域详解