POJ 2004解题报告
来源:互联网 发布:c语言运算符优先级规律 编辑:程序博客网 时间:2024/06/05 04:34
Mix and Build
Time Limit: 5000MS Memory Limit: 65536KTotal Submissions: 3246 Accepted: 963Case Time Limit: 2000MS Special Judge
Description
In this problem, you are given a list of words (sequence of lower case letters). From this list, find the longest chain of words w1, ..., wn such that wi is a mixed extension of wi-1. A word A is a mixed extension of another word B if A can be formed by adding one letter to B and permuting the result. For example, "ab", "bar", "crab", "cobra", and "carbon" form a chain of length 5.
Input
The input contains at least two, but no more than 10000 lines. Each line contains a word. The length of each word is at least 1 and no more than 20. All words in the input are distinct.
Output
Write the longest chain that can be constructed from the given words. Output each word in the chain on a separate line, starting from the first one. If there are multiple longest chains, any longest chain is acceptable.
Sample Input
abarcarcobarbrancarboncarbonscobracrabcrayonnarc
Sample Output
abbarcrabcobracarboncarbons
题意:输出若干字符串中按照如下规则的最长的字符串序列(规则:从短到长,并且相邻的两个字符串只一个字符)。
思路:类似dp的方法,dp[i]=max(dp[i],dp[j]+1),其中j是i加一个字符变成的串...,按照这个思路写的代码 4875MS 险过。。
- POJ 2004解题报告
- poj数百篇解题报告
- poj 1141解题报告
- poj 1001解题报告
- poj 1011 解题报告
- poj 1087 解题报告
- poj 2153解题报告
- poj 2051解题报告
- POJ 1167 解题报告
- poj 1026 解题报告
- POJ 1077 解题报告
- POJ 1042 解题报告
- POJ 1095 解题报告
- POJ 1159解题报告
- poj 2312解题报告
- POJ 1001解题报告
- POJ 1002解题报告
- POJ 1006解题报告
- 看看微软语料里的特征都是些啥
- 位与运算符 "&" 运算符 x=x&(x-1)
- 进度条
- [zz] 标准C++的类型转换符:static_cast、dynamic_cast、reinterpret_cast和const_cast
- javascript 内部函数的this
- POJ 2004解题报告
- perl语言中的标量数据(一)
- jms /queue问题解决
- 恢复SET UNUSED操作
- 配置linux ip
- 实训java第二课 数据类型 进制 等额本息还款
- 3G嵌入式软件人才全线告急 月薪过万人才难觅
- Spring学习总结3(bean的属性详解)
- poj 2395 Out of Hay