首页 > 其他 > 详细

NYOJ 214 单调递增子序列(二)

时间:2015-11-10 21:03:35      阅读:349      评论:0      收藏:0      [点我收藏+]

#include<stdio.h>
#include<algorithm>
using namespace std;
const int Max=100100;
int num[Max];
int top=0;
int main()
{
 int n;
 while(~scanf("%d",&n))
 {
  scanf("%d",&num[0]);
  top=1;
  for(int i=1;i!=n;i++)
  {
   scanf("%d",&num[i]);
   int *p=lower_bound(num,num+top,num[i]);
   if(p-num==top) ++top;
   *p=num[i];  
  }
  printf("%d\n",top);
 }
} //最优代码,留个模板。。。

NYOJ 214 单调递增子序列(二)

原文:http://www.cnblogs.com/mycapple-zgs-111411/p/4954029.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!