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的更多相关文章
随机推荐
- unity3d之在屏幕上画线
如何在屏幕上画线,简单的代码如下: using UnityEngine; public class Test : MonoBehaviour { void OnGUI() { GL.LoadOrtho ...
- Linux的iptables常用配置范例(1)
以下是来自 http://wiki.ubuntu.org.cn/IptablesHowTo 上的配置说明 可以通过/sbin/iptables -F清除所有规则来暂时停止防火墙: (警告:这只适合在没 ...
- Android IBinder的linkToDeath介绍
先看官方解释: The linkToDeath() method can be used to register a IBinder.DeathRecipient with the IBinder, ...
- iOS之Xcode修改应用图标
随便找一个PNG为后缀的图标, 把它重命名为 icon.png 就可以了. 再次启动 IPhone 模拟器. 就成功了. 及时尺寸不符合审核规范,也是可以显示出来的,供测试效果吧. 为iPhone设 ...
- Arduino线程库ProtoThreads
参考: Arduino线程库ProtoThreads 一个“蝇量级” C 语言协程库
- linux分区-df
转自:http://baike.baidu.com/link?url=tyonI3NCB3F-ytIQz72PY-8uAaUQgfFFXbyKAea1e2NiB_t5AsE0MLOLc2LcqOiS ...
- 必须熟悉的vim快捷键操作
转载请表明出处http://www.dabu.info/?p=801 Vim/Vi 没有菜单,只有命令 Vim/Vi 工作模式介绍:插入模式 和 命令模式 是vi的两个基本模式.——插入模式 ,是用 ...
- 【HNOI2013】题解 bzoj3139~bzoj3144
比赛 题目: http://www.lydsy.com/JudgeOnline/problem.php?id=3139 题解: 3$\le$N$\le$10,比较明显是一个搜索题,一开始我是直接搜了 ...
- jQuery简单实现图片预加载
我们在做网站的时候经常会遇到这样的问题:一个页面有大量的图片导致页面加载速度缓慢,经常会出现一个白页用户体验很不好.那么如何解决这个问题呢?下面我来介绍一种在实际应用中经常会使用到的js预加载的方法. ...
- Java 基础类型转换byte数组, byte数组转换基础类型
Java 基础类型转换byte数组, byte数组转换基础类型 Java类型转换 java类对象转化为byte数组