高效算法-位运算
lab104_yifan
这个作者很懒,什么都没留下…
展开
-
UVA 687 - Lattice Practices(暴力枚举+位运算)
Lattice Practices Once upon a time, there was a king who loved beautiful costumes very much. The king had a special cocoon bed to make excellent cloth of silk. The cocoon bed had 16 smal原创 2013-12-30 23:08:55 · 1482 阅读 · 1 评论 -
UVA 690 Pipeline Scheduling (搜索+位运算+剪枝)
690 - Pipeline Scheduling题意:10个任务,5个通道,要求每个通道都能放下10个任务且不冲突,然后每个通道的放的方式间隔都是一样的,问最短需要时间。思路:利用位运算保存每个通道的放置方法,然后去深搜,要加剪枝。详细见代码代码:#include #include #define min(a,b) ((a)<(b)?(a):(b))#define原创 2014-04-08 16:01:02 · 2637 阅读 · 4 评论 -
UVA 649 - You Who?(搜索+位运算+剪枝)
链接:649 - You Who?题意:N个人,每个人都有一些认识的人,现在要求把这些人分成两堆,两堆人数差不超过1,然后要让两堆人两两认识,没两个人认识需要花费1分钟,要使得总花费时间最少,问方案。思路:每种情况的花费时间,肯定取决于那个对于分到的一堆人里面,不认识的人最多的那个人,然后利用位运算去记录每个人认识的人,还是利用位运算去枚举两堆的情况。搜索所有答案。加了几个时间才勉强跑原创 2014-04-05 17:03:42 · 1214 阅读 · 0 评论 -
UVA 11600 - Masud Rana(状态压缩DP+记忆化搜索)
EMasud RanaInput: Standard InputOutput: Standard Output Masud Rana, A Daring Spy Of Bangladesh Counter Intelligence. He is in a new mission. There is a total n cities i原创 2014-03-08 11:42:39 · 2857 阅读 · 2 评论 -
UVA 11795 - Mega Man's Mission(状态压缩dp)
BMega Man’s MissionsInputStandard InputOutputStandard Output Mega Man is off to save the world again. His objective is to kill the Robots created by原创 2014-02-20 09:37:49 · 1694 阅读 · 0 评论 -
12235 - Help Bubu(状态压缩dp)
Bubu's bookshelf is in a mess! Help him!There are n books on his bookshelf. We define the mess value to be the number of segments of consecutive equal-height books. For example, if the book height原创 2014-02-28 22:59:35 · 1365 阅读 · 0 评论 -
UVA 1099 - Sharing Chocolate(记忆化搜索+状态压缩)
Chocolate in its many forms is enjoyed by millions of people around the world every day. It is a truly universal candy available in virtually every country around the world.You find that the only th原创 2014-02-16 14:13:36 · 3067 阅读 · 2 评论 -
UVA 1252 - Twenty Questions(状态压缩DP+记忆化搜索)
Consider a closed world and a set of features that are defined for all the objects in the world. Each feature can be answered with ``yes" or ``no". Using those features, we can identify any object fro原创 2014-02-23 22:01:22 · 2082 阅读 · 4 评论 -
UVA 1326 - Jurassic Remains(技巧枚举+位运算)
Paleontologists in Siberia have recently found a number of fragments of Jurassic period dinosaur skeleton. The paleontologists have decided to forward them to the paleontology museum. Unfortunately, t原创 2014-02-07 06:06:54 · 1695 阅读 · 0 评论 -
1381 - Balancing the Scale (技巧枚举+位运算)
You are given a strange scale (see the figure below), and you are wondering how to balance this scale. After several attempts, you have discovered the way to balance it -- you need to put different nu原创 2014-02-06 03:38:11 · 1817 阅读 · 0 评论 -
UVA 608 - Counterfeit Dollar(直接枚举)
Counterfeit Dollar Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit even though its color and size make原创 2014-01-27 21:27:37 · 1491 阅读 · 0 评论 -
UVA 517 - Word (周期规律+位运算)
Word Dr. R. E. Wright's class was studying modified L-Systems. Let us explain necessary details. As a model let us have words of length n over a two letter alphabet . The words are cyc原创 2014-01-27 03:11:49 · 1645 阅读 · 0 评论 -
11127 - Triple-Free Binary Strings(dfs+位运算)
Problem JTriple-Free Binary Strings Input: Standard InputOutput: Standard Output A binary string consists of ones and zeros. Given a binary string T, if there is no binary string S such tha原创 2014-01-05 12:59:21 · 1276 阅读 · 0 评论 -
UVA 818 - Cutting Chains(暴力+dfs判环+位运算)
Cutting Chains What a find! Anna Locke has just bought several links of chain some of which may be connected. They are made from zorkium, a material that was frequently used to manufactu原创 2014-01-04 11:23:34 · 5563 阅读 · 2 评论 -
HDU 5014 Number Sequence(西安网络赛H题)
HDU 5014 Number Sequence题目链接思路:对于0-n,尽量不让二进制中的1互相消掉就是最优的,那么只要两个数只要互补就可以了,这样每次从最大的数字,可以找到和他互补的数字,然后这个区间就能确定了,然后剩下的递归下去为一个子问题去解决代码:#include #include const int N = 100005;int n, a[N]原创 2014-09-14 21:00:02 · 2017 阅读 · 8 评论