欢迎访问我的个人网站==》 jiashubing.cn
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4681题目大意:给定三个字符串A,B,C 求最长的串D,要求(1)D是A的字序列 (2)D是B的子序列 (3)C是D的连续子序列Sample Input2aaaaaaaaaaaabcdefacebdfcfSample OutputCase #1: 4Case #2: 3HintFor test one, D is "aaaa", and for test two, D is "acf".分析:求A和B的LCS,正反各求一次得到dp1和dp2,然后枚举C在A,B 阅读全文
posted @ 2013-08-21 19:53 贾树丙 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5048Sample Input4 3 Sample Output3题目大意:n个格子排成一条直线,可以选择涂成红色或蓝色,问最少m个连续为红色的方案数。分析:递推法dp[i]表示前i个最少m个连续为红色的方案数。转移时,分类讨论:1、前i-1个已经满足这个性质,那么,第i个随意涂色,方案数为dp[i-1]*2。2、前i-1个不满足这个性质,那么,要想成为方案,区间[i-m+1,i]必须涂成红色。并且,下标为i-m这个点必须是蓝色,否则就与情况1重复了。而且正是由于这 阅读全文
posted @ 2013-08-21 18:07 贾树丙 阅读(303) 评论(0) 推荐(0) 编辑
摘要: Hackers’ CrackdownMiracle Corporations has a number of system services running in a distributed computer system which is a prime target for hackers. The system is basically a set ofNcomputer nodes with each of them running a set ofNservices. Note that, the set of services running on every node is sa 阅读全文
posted @ 2013-08-21 16:11 贾树丙 阅读(966) 评论(2) 推荐(0) 编辑