hdu 1503 Advanced Fruits(DP)】的更多相关文章

题意: 将两个英文单词进行合并.[最长公共子串只要保留一份] 输出合并后的英文单词. 思路: 求最长公共子串. 记录路径: mark[i][j]=-1:从mark[i-1][j]转移而来. mark[i][j]=0:从mark[i-1][j-1]转移而来. mark[i][j]=1:从mark[i][j-1]转移而来. 代码: char s1[105], s2[105]; int dp[105][105]; int mark[105][105]; void print(int x,int y){…
Advanced Fruits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1360    Accepted Submission(s): 672Special Judge Problem Description The company "21st Century Fruits" has specialized in cre…
Advanced Fruits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3340    Accepted Submission(s): 1714Special Judge Problem Description The company "21st Century Fruits" has specialized in cr…
题意:给定两个字符串,让你求一个最短的字符串,并且这个字符串包含给定的两个. 析:看到这个题,我知道是DP,但是,不会啊...完全没有思路么,我就是个DP渣渣,一直不会做DP. 最后还是参考了一下题解,主要是这样的,要想最短,就必须让两个字符串重复的最多,也就是LCS, 然后把剩下的不相同的字符再给补上,说起来容易,实现起来,难!反正对我来说是难. 然后根据LCS的原理,我们对这个两字符串,进行标记,什么意思呢,就是说,如果某个字符是公共字符, 等到输出时,我们只输出一次,而对于不是公共的,我们…
Problem Description The company "21st Century Fruits" has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. Most times this method doesn't work, but sometimes, in very rare cases, a…
http://acm.hdu.edu.cn/showproblem.php?pid=1503 题意: 给出两个串,现在要确定一个尽量短的串,使得该串的子串包含了题目所给的两个串. 思路: 这道题目就是要我们求LCS,记录好路径就好. #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #include<sstream> #include<vect…
Advanced Fruits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1426    Accepted Submission(s): 719Special Judge Problem Description   The company "21st Century Fruits" has specialized in c…
http://acm.hdu.edu.cn/showproblem.php?pid=5791 Two Problem Description   Alice gets two sequences A and B. A easy problem comes. How many pair of sequence A' and sequence B' are same. For example, {1,2} and {1,2} are same. {1,2,4} and {1,4,2} are not…
Problem Description 小A想通过合理投资银行理财产品达到收益最大化.已知小A在未来一段时间中的收入情况,描述为两个长度为n的整数数组dates和earnings,表示在第dates[i]天小A收入earnings[i]元(0<=i<n).银行推出的理财产品均为周期和收益确定的,可描述为长度为m的三个整数数组start.finish和interest_rates, 若购买理财产品i(0<=i<m),需要在第start[i]天投入本金,在第finish[i]天可取回本…
Advanced Fruits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3613    Accepted Submission(s): 1867 Special Judge Problem Description The company "21st Century Fruits" has specialized in…