HDU5842
Lweb and String
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 492 Accepted Submission(s): 312
Problem Description
Oneday, he decided to transform this string to a new sequence.
You need help him determine this transformation to get a sequence which has the longest LIS(Strictly Increasing).
You need transform every letter in this string to a new number.
A is the set of letters of S, B is the set of natural numbers.
Every injection f:A→B can be treat as an legal transformation.
For example, a String “aabc”, A={a,b,c}, and you can transform it to “1 1 2 3”, and the LIS of the new sequence is 3.
Now help Lweb, find the longest LIS which you can obtain from S.
LIS: Longest Increasing Subsequence. (https://en.wikipedia.org/wiki/Longest_increasing_subsequence)
Input
Then T lines follow, the i-th line contains a string S only containing the lowercase letters, the length of S will not exceed 105.
Output
Sample Input
Sample Output
//2016.8.16
#include<iostream>
#include<cstdio>
#include<set> using namespace std; set<int> st; int main()
{
int T, kase = ;
string s;
cin>>T;
while(T--)
{
cin>>s;
st.clear();
for(int i = ; i < s.size(); i++)
{
st.insert(s[i]);
}
printf("Case #%d: ", ++kase);
cout<<st.size()<<endl;
} return ;
}
HDU5842的更多相关文章
随机推荐
- jQuery学习笔记—— .html(),.text()和.val()的使用
本节内容主要介绍的是如何使用jQuery中的.html(),.text()和.val()三种方法,用于读取,修改元素的html结构,元素的文本内容,以及表单元素的value值的方法.jQuery中为我 ...
- 如何高效的用判断用js判断ie6
用js判断ie6的方法有很多,如: 1. var isIE=!!window.ActiveXObject; var isIE6=isIE&&!window.XMLHttpRequest ...
- phpmailer 的使用
[转载]http://blog.csdn.net/liruxing1715/article/details/7914974 <?php header('Content-Type:text/htm ...
- hibernate--多对一单向关联 (重点!!!)
一个用户组包含多个用户, 每个用户属于一个组. 一个人可以有多个车, 每个车属于一个人. 一个人有很多梦想, 一个特定的梦想属于一个人. 错误做法: person里 有 personid, perso ...
- Jquery 源码学习
https://www.youtube.com/watch?v=qeMFEz_ufZc http://stackoverflow.com/questions/7194784/analysing-the ...
- unable to fund vcvarsall.bat
通过easy_install安装gfirefly的时候,发生了unable to fund vcvarsall.bat的问题, 于是去网上搜索了一下,看到这个帖子,看起来应该是终极解决方案: 彻底解决 ...
- PC端 H5实现拍照并上传
<!DOCTYPE HTML><html><head> <meta charset="UTF-8"> <meta name=& ...
- (中等) POJ 2528 Mayor's posters , 离散+线段树。
Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral electio ...
- MYsql数据库ERROR总结
描述:#Warning: Using a password on the command line interface can be insecure.#ERROR 1045 (28000): Acc ...
- AFNetworing进行POST上传 分类: ios技术 2015-04-01 17:03 73人阅读 评论(0) 收藏
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; //申明返回的结果是json类型 m ...