标签:style blog http io ar color os sp for
3 aaa ababc abklmncdefg
1 3 7
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; char a[10010]; int dp[10010]; int main() { int i,j,n,len; scanf("%d",&n); getchar(); while(n--) { gets(a); len=strlen(a); for(i=0;i<len;i++) dp[i]=1; for(i=len-2;i>=0;i--) { for(j=i+1;j<len;j++) { if(a[i]<a[j]&&dp[i]<dp[j]+1) dp[i]=dp[j]+1; } } sort(dp,dp+len); printf("%d\n",dp[len-1]); } return 0; }
标签:style blog http io ar color os sp for
原文地址:http://blog.csdn.net/hdd871532887/article/details/41361081