上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 33 下一页
摘要: 描述Given a directed graph containing n vertice (numbered from 1 to n) and m edges. Can you tell us how many different Hamiltonian Cycles are there in t... 阅读全文
posted @ 2015-09-18 22:30 20143605 阅读(370) 评论(0) 推荐(0) 编辑
摘要: 题目大意:问能不能用不超过6张2x2的方纸在4x4的方格中摆出给定的图形?题目分析:暴力枚举出P(9,6)种(最坏情况)方案即可。代码如下:# include# include# include# includeusing namespace std;int vis[10];char mp[8][1... 阅读全文
posted @ 2015-09-17 21:21 20143605 阅读(800) 评论(0) 推荐(0) 编辑
摘要: 题目大意:一种环能打开和闭合。现在有n(1# include# include# include# includeusing namespace std;int n,ans,st[15],s[15],vis[15];int bitCount(int sta){ return sta==0?0:... 阅读全文
posted @ 2015-09-17 15:39 20143605 阅读(899) 评论(0) 推荐(0) 编辑
摘要: 题目大意:给一张无向图,节点编号从1到n(n# include# include# includeusing namespace std;int mp[25][25],vis[25],ans;bool ok(int s,int e){ if(s==e) return true; ... 阅读全文
posted @ 2015-09-15 20:43 20143605 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 题目大意:有n件物品,每件物品有m个特征,可以对特征进行询问,询问的结果是得知某个物体是否含有该特征,要把所有的物品区分出来(n个物品的特征都互不相同)最小需要多少次询问?题目分析:定义dp(s,a)表示询问了的特征集合为s,物体含有特征集合a中的所有特征,但不含特征集合 s^a 中的所有特征时还需... 阅读全文
posted @ 2015-09-15 12:13 20143605 阅读(472) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionI used to think I could be anything, but now I know that I couldn't do anything. So I started traveling.The nation looks like a con... 阅读全文
posted @ 2015-09-11 13:45 20143605 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 题目大意:数的最大独立集问题。特殊在要求回答答案是否唯一。题目分析:定义状态dp(i,1),dp(i,0)分别表示以i为根节点的子树选不选i最多可选的人数,f(i,1),f(i,0)分别表示以i为根节点的子树选不选i的方案唯一性。则当选i时,i的子节点都不能选,否则,可选可不选,因此状态转移方程如下... 阅读全文
posted @ 2015-09-08 22:14 20143605 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题目大意:一家工厂,一个老板(编号为0),n个工人(编号1~n),其中,有的工人是中层领导,管辖一部分其他工人。现在大家要签署一份加薪申请书,但是按照规定不能越级上访,所以只能通过一层层的中间领导传到老板手中。当某个中间领导的手下签名员工人数达到 m% 时,他也会签上自己的名字。为确保申请书顺利到达... 阅读全文
posted @ 2015-09-08 15:16 20143605 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 题目大意:给一个有小括号和中括号组成的序列,满足题中的三个条件时,是合法的。不满足时是不合法的,问将一个不合法的序列最少添加几个括号可以使之变成合法的。输出最短合法序列。题目分析:这是《入门经典》上的一道例题。如果仅让求最短序列是极简单的,定义dp(i,j)表示将区间 i~j 变为合法添加的最小字符... 阅读全文
posted @ 2015-09-08 11:37 20143605 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题目大意:将一段长为L的木棒在给定的n个切割点切开,每切一次的花费等于当前木棒的长度。求切成n+1段的最小花费。题目分析:区间DP。定义dp(i,j)表示切割区间i~j的花费,则 f(i,j)=min(f(i,k)+f(k,j))+dist(i,j)。时间复杂度为n3。代码如下:# include#... 阅读全文
posted @ 2015-09-07 21:56 20143605 阅读(176) 评论(0) 推荐(0) 编辑
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 33 下一页