HDU5842-Lweb and String
来源:互联网 发布:java package怎么用 编辑:程序博客网 时间:2024/05/20 00:51
Lweb and String
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 948 Accepted Submission(s): 516
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 injectionf: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 fromS .
LIS: Longest Increasing Subsequence. (https://en.wikipedia.org/wiki/Longest_increasing_subsequence)
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.
Every injection
For example, a String “aabc”,
Now help Lweb, find the longest LIS which you can obtain from
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) .
ThenT lines follow, the i-th line contains a string S only containing the lowercase letters, the length of S will not exceed 105 .
Then
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
2aabccacdeaa
Sample Output
Case #1: 3Case #2: 4
Author
UESTC
Source
2016中国大学生程序设计竞赛 - 网络选拔赛
Recommend
wange2014
题意:给你一个字符串,其中的相同的字符可以用一个数字代替,问转化后最长上升子序列为多少
解题思路:水题,判断出现了几种不同的单词即为答案
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <cmath> #include <map> #include <cmath> #include <set> #include <stack> #include <queue> #include <vector> #include <bitset> #include <functional> using namespace std;#define LL long long const int INF = 0x3f3f3f3f;int flag[30];char s[1000005];int main(){int t;int q = 1;scanf("%d", &t);while (t--){scanf("%s", &s);int k = strlen(s);memset(flag, 0, sizeof flag);int cnt = 0;for (int i = 0; i < k; i++){if (flag[s[i] - 'a' ]== 0){cnt++;}flag[s[i] - 'a'] = 1;}printf("Case #%d: %d\n", q++, cnt);}return 0;}
0 0
- HDU5842-Lweb and String
- hdu5842-Lweb and String
- hdu5842-Lweb and String-续缘之路
- hdu5842-Lweb and String-续缘之路
- 2016中国大学生程序设计竞赛 - 网络选拔赛 1011 Lweb and String hdu5842
- HDU5842——Lweb and String(CCPC网络赛第11题)
- Lweb and String
- Lweb and String
- Lweb and String(set)
- hdu 5842 Lweb and String
- HDU 5842 Lweb and String
- hdu 5842 Lweb and String
- HDU 5842 Lweb and String
- HDU 5842 Lweb and String【】
- hdu 5842 Lweb and String
- HDU 5842Lweb and String
- hdu Lweb and String ( LIS)
- 杭电5842之Lweb and String
- charles使用教程
- Oracle笔记(十五) 数据库备份
- 安装jdk1.8后,修改%JAVA_HOME%为jdk1.6的路径,但运行java -version没有变化
- 2017013
- 组装Json
- HDU5842-Lweb and String
- Java中的面试题 [3] --- Java高级知识、并发、多线程、JVM调优、分布式、设计模式等
- 从服务器获取的图片缩小显示
- 串口协议分析
- MySql按周,按月,按日分组统计数据
- Oracle笔记(十六) 数据库设计范式
- 集团企业税务管理浅析
- Http网络传递参数中文乱码问题解决办法
- 一元线性回归的详解及其Spss和Java的实现 之 理论说明