nyoj 17 最长子序列相关问题
2016-08-06 21:04
190 查看
#include<stdio.h> #include<string.h> int main() { int T,count; char a[10000],dp[30]; scanf("%d",&T); while(T--) { count=0; memset(dp,0,sizeof(dp)); scanf("%s",a); int len=strlen(a); for(int i=0;i<len;i++) { for(int j=count;j>=0;j--) { if(a[i]>dp[j]) { dp[j+1]=a[i]; if(j==count) count++; break; } } } printf("%d\n",count); } return 0; }
相关文章推荐
- Persistent and Transient Data Structures in Clojure
- redis消息订阅和发布实例
- 数位DP学习小结
- 2.搜索之路——Nutch搭建
- Java自学手记——struts2
- 体验标签的用法
- C++ 值传递、指针传递、引用传递详解
- 最大费用循环流(帮助小罗拉,uva 1659)
- CodeForces-696C Please(数学题,快速幂取模,乘法逆元)
- VS2013配置opencv
- poj2524 Ubiquitous Religions
- 结构体的使用简述
- 1119 Collecting Coins 湖南省第八届
- 解决Emacs无法输入中文的问题
- 1.搜索之路——Nutch与Lucene
- 约瑟夫问题
- 如何使用Git上传项目代码到github
- NYOJ-35 表达式求值
- php trim()函数
- 跟我一起写Makefile(2)--- Makefile介绍+Makefile规则