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的更多相关文章
随机推荐
- USACO Section 1.1 Your Ride Is Here 解题报告
题目 问题描述 将字符串转变为数字,字母A对应的值为1,依次对应,字母Z对应的值为26.现在有一个字符串,将其中的每个字符转变为数字之后进行累乘,最终的结果对47求余数. 题目给你两个字符串,其中的字 ...
- hibernate---树状映射
总公司--分公司1, 分公司2 分公司1: 分公司1下部门1, 分公司1下部门2 分公司2: Org.java: package com.bjsxt.hibernate; import java.ut ...
- [iOS Animation]-CALayer 图层几何学
图层几何学 不熟悉几何学的人就不要来这里了 --柏拉图学院入口的签名 在第二章里面,我们介绍了图层背后的图片,和一些控制图层坐标和旋转的属性.在这一章中,我们将要看一看图层内部是如何根据父图层和兄弟图 ...
- iOS推送的众多坑
新来的一家公司,昨天和同事解决推送问题(工程里有集成百度推送和环信即时通讯),信誓旦旦的声称:" app在前台和后台运行时,推送触发的是didReceiveRemoteNotificatio ...
- smarty3-笔记
smarty3笔记 1.Samrty.class.php 的compile_dir 和template_dir类属性 是private的,setTemplateDir和setCompileDir类方法 ...
- The account '...' is no team with ID '...'
iOS升到9.2之后,有一个大坑,原先真机调试的开发者账号(未付费),连不了Xcode了,会弹出一个提示框提示你, The account '...' is no team with ID '...' ...
- iOS开源库--最全的整理 分类: ios相关 2015-04-08 09:20 486人阅读 评论(0) 收藏
youtube下载神器:https://github.com/rg3/youtube-dl 我擦咧 vim插件:https://github.com/Valloric/YouCompleteMe vi ...
- java 对象比较
class Book{ private String title ; private double price ; public Book(String title , double pr ...
- bzoj3809
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3809 题目大意: Autumn和Bakser又在研究Gty的妹子序列了!但他们遇到了一个难题 ...
- 解决IE增强配置的问题
windows2003上: win 2008上, 其实ie8就是在2008上的 为所有用户启用 IE ESC 关闭所有 Internet Explorer 的实例. 单击"开始", ...