Problem Description

Lweb has a string S.

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
The first line of the input contains the only integer T,(1≤T≤20).

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
For each test case, output a single line "Case #x: y", where x is the case number, starting from 1. And y is the answer.
 
Sample Input

aabcc
acdeaa Sample Output
Case #:
Case #:

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5842

***************************************************

题意:我只能说题意神马都是浮云,纯属干扰,直接看代码吧

 #include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
#define N 1100 char s[];
int v[]; int main()
{
int i,T,k=,len; scanf("%d", &T); while(T--)
{
memset(v, , sizeof(v));
int ans=;
scanf("%s",s);
len=strlen(s); for(i=;i<len;i++)
v[s[i]-'a']=; for(i=;i<;i++)
if(v[i])
ans++; printf("Case #%d: %d\n", k++,ans);
}
return ;
}

2016中国大学生程序设计竞赛 - 网络选拔赛 1011 Lweb and String的更多相关文章

  1. 2016中国大学生程序设计竞赛 - 网络选拔赛 C. Magic boy Bi Luo with his excited tree

    Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migi ...

  2. 2016中国大学生程序设计竞赛 - 网络选拔赛 J. Alice and Bob

    Alice and Bob Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  3. 2016中国大学生程序设计竞赛 网络选拔赛 I This world need more Zhu

    This world need more Zhu Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Jav ...

  4. 2016中国大学生程序设计竞赛 - 网络选拔赛 1004 Danganronpa

    Problem Description Chisa Yukizome works as a teacher in the school. She prepares many gifts, which ...

  5. 2016中国大学生程序设计竞赛 - 网络选拔赛 1001 A water problem (大数取余)

    Problem Descripton Two planets named Haha and Xixi in the universe and they were created with the un ...

  6. 2018中国大学生程序设计竞赛 - 网络选拔赛 1001 - Buy and Resell 【优先队列维护最小堆+贪心】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6438 Buy and Resell Time Limit: 2000/1000 MS (Java/O ...

  7. 2018中国大学生程序设计竞赛 - 网络选拔赛 1010 YJJ's Salesman 【离散化+树状数组维护区间最大值】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6447 YJJ's Salesman Time Limit: 4000/2000 MS (Java/O ...

  8. 2018中国大学生程序设计竞赛 - 网络选拔赛 1009 - Tree and Permutation 【dfs+树上两点距离和】

    Tree and Permutation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  9. HDU 6154 - CaoHaha's staff | 2017 中国大学生程序设计竞赛 - 网络选拔赛

    /* HDU 6154 - CaoHaha's staff [ 构造,贪心 ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 题意: 整点图,每条线只能连每个方格的边或者对角线 问面积大于n的 ...

随机推荐

  1. SpringMVc上传excel或csv文件

    1.JSP页面代码 <form enctype=""multipart/form-data" method="post"> <inp ...

  2. Webdriver实现对菜单栏的灵活切换功能,附上代码,类似的菜单栏切换可以自己封装

    有时一级菜单下可能会有二级菜单,这时就需要对其下面的元素进行判断,如果使用webdriver原生的方法去获取未知的元素进行判断,显然是不可能的,因为webdriver本身就是基于明确的元素进行定位的, ...

  3. MySQL python组件安装

    可使用pip进行安装 pip install MySQL-python 如出现以下错误 _mysql.c::: 错误:my_config.h:没有那个文件或目录 _mysql.c::: 错误:mysq ...

  4. 五种JSP页面跳转方法详解

    1. RequestDispatcher.forward() 是在服务器端起作用,当使用forward()时,Servlet engine传递HTTP请求从当前的Servlet or JSP到另外一个 ...

  5. 浅析PageRank算法

    很早就对Google的PageRank算法很感兴趣,但一直没有深究,只有个轮廓性的概念.前几天趁团队outing的机会,在动车上看了一些相关的资料(PS:在动车上看看书真是一种享受),趁热打铁,将所看 ...

  6. IntelliJ IDEA 部署远程服务

    今天产品遇到个本地无法重现,服务器上却出现的 Bug. 想起来 IDEA 有远程调试的功能就拿来用用. 教程如下: 1. 创建 tomcat service 2. 填入服务器的 IP 和端口 3. 确 ...

  7. 第六百二十六天 how cna I 坚持

    年代数竟然算错了,哎,好笨啊.2000年得有100代人了,好傻啊. 1到100,哎. 早上好像想通了呢,哎.又不打算去拉萨了. 到底..哎.睡觉.

  8. Python logging模块使用记录

    1.简单的将日志打印到屏幕 import logging logging.debug('This is debug message') logging.info('This is info messa ...

  9. Debian安装autoconf

    ###安装autoconf wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.65.tar.gz \ && tar -xzv ...

  10. nefu 449 超级楼梯 &&nefu 911 跨楼梯

    nefu 449 超级楼梯 Description 有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法? Input 输入数据首先包含一个整数N,表示测试实例的 ...