09 2012 档案
HRBUST 1541 集合划分【01背包】
摘要:Description对于从1到N (1 <= N <= 39) 的连续整数集合,能划分成两个子集合,且保证每个集合的数字和是相等的。举个例子,如果N=3,对于{1,2,3}能划分成两个子集合,每个子集合的所有数字和是相等的:{3} 和 {1,2}这是唯一一种分法(交换集合位置被认为是同一种划分方案,因此不会增加划分方案总数) 如果N=7,有四种方法能划分集合{1,2,3,4,5,6,7},每一种分法的子集合各数字和是相等的:{1,6,7} 和 {2,3,4,5} {注 1+6+7=2+3+4+5}{2,5,7} 和 {1,3,4,6}{3,4,7} 和 {1,2,5,6}{1,2 阅读全文
posted @ 2012-09-14 10:35 crying_Dream 阅读(235) 评论(0) 推荐(0)
POJ 3124 The Bookcase【dp]
摘要:DescriptionNo wonder the old bookcase caved under the massive piles of books Tom had stackedon it. He had better build a new one, this time large enough to hold all of his books. Tomfinds it practical to have the books close at hand when he works at his desk. Therefore, he is imagining a compact sol 阅读全文
posted @ 2012-09-14 09:50 crying_Dream 阅读(425) 评论(0) 推荐(0)
HRBUST 1473 教主的遗产【状态压缩】
摘要:Description恭送教主!教主在2012年7月19日上午10:48,坐上前往北京的火车,从此开始了高富帅的生活。在教主的的大学四年ACM生涯中,他用事实告诉我们,要想在比赛拿奖,除了平时的刻苦努力外,很大一部分还要依赖比赛时是做题策略,简单来讲就是做题顺序,唯有想把能过的都过掉,然后再过难题,这样才能在比赛中拿奖。我们将用这个做题顺序量化表示,即AC系数,AC系数越大,拿奖可能性就越大。在比赛中会给出n个题,不同做题顺序会有不同的AC系数,假如A先做,B后做的话,B对A的AC系数为4, 反过来 B先做,A后做的话,A对B的AC系数为5,说明先做B后做A将得到更高的AC系数。设Sij表示第 阅读全文
posted @ 2012-09-07 09:16 crying_Dream 阅读(215) 评论(0) 推荐(0)
ZOJ 3471 Most Powerful 【状态压缩】
摘要:Recently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atoms collide, one of them disappears and a lot of power is produced. Researchers know the way every two atoms perform when collided and the power every two 阅读全文
posted @ 2012-09-06 21:19 crying_Dream 阅读(214) 评论(0) 推荐(0)
POJ 3254 Corn Fields【状态压缩】
摘要:DescriptionFarmer John has purchased a lush new rectangular pasture composed ofMbyN(1 ≤M≤ 12; 1 ≤N≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, some of the squares are infertile and can't be planted. Canny FJ knows that the cows dislike 阅读全文
posted @ 2012-09-06 00:36 crying_Dream 阅读(613) 评论(0) 推荐(0)
【转】链表经典问题总汇
摘要:转自:http://blog.csdn.net/vividonly/article/details/6673758收集了一下链表常见的面试题:1、如何判断一个单链表有环2、如何判断一个环的入口点在哪里3、如何知道环的长度4、如何知道两个单链表(无环)是否相交5、如果两个单链表(无环)相交,如何知道它们相交的第一个节点是什么6、如何知道两个单链表(有环)是否相交7、如果两个单链表(有环)相交,如何知道它们相交的第一个节点是什么1、采用快慢步长法。令两个指针p和q分别指向头结点,p每次前进一步,q每次前进两步,如果p和q能重合,则有环。可以这么理解,这种做法相当于p静止不动,q每次前进一步,所有肯 阅读全文
posted @ 2012-09-03 14:16 crying_Dream 阅读(230) 评论(0) 推荐(0)