同类类于poj3311,但是要简单,不用转什么弯子
直接 十种气体 每种是否存在的状态 s,然后 dp[s] = max(dp[s],dp[s - {被碰的气体状态}] + 两气体相碰获得的价值);想起来不难,写起来也算比较简单
int n;
int dp[1<<12];
int mp[10 + 5][10 + 5];
void init() {
memset(mp,0...
分类:
其他好文 时间:
2014-08-20 21:13:02
阅读次数:
355
A Little Pony and Crystal
Mine
题意:给一个奇数n,打印菱形图案,整个图形占n*n格。
例如--->输入3,则打印图案如下
*D*
DDD
*D*
算法:
由中间那行为n个D,以t = n/2为界先打上半边,每一行由D隔开的*的个数为离中间行的距离。
D的个数为n-当前行离中间行的距离*2。
下半边同理。
#in...
分类:
其他好文 时间:
2014-08-18 16:20:22
阅读次数:
249
一个公司生产一种2*3规模的芯片,但是原材料上面有一些地方是不能用来当作芯片材料的,给出原料大小,及上面不能做原料的点,问你怎么分解,可以使生成芯片最大化。
对M进行三进制状压
last数组存储第i-1行和i-2行状态,cur数组存储i行和i-1行状态
cur[k]=2; // 本行k位置和上行k位置都不可用
cur[k]=1; // 本行k位置可用,上行k位置不可用
c...
分类:
其他好文 时间:
2014-08-17 17:03:12
阅读次数:
234
Problem Description
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands i...
分类:
其他好文 时间:
2014-08-17 10:29:42
阅读次数:
246
[BestCoder Round #5]冠军的奖励是小米3手机一部
恭喜福州大学杨楠获得[BestCoder Round #4]冠军(iPad Mini一部)
《BestCoder用户手册》下载
Defence of the Trees
Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/65536 K (Ja...
分类:
其他好文 时间:
2014-08-15 14:45:50
阅读次数:
314
http://poj.org/problem?id=3254Corn FieldsTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 7588Accepted: 4050DescriptionFarmer John has purchas...
分类:
其他好文 时间:
2014-08-14 23:10:31
阅读次数:
278
#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;int dx[]={0,0...
分类:
其他好文 时间:
2014-08-14 16:04:48
阅读次数:
256
这是我做状压DP的第一道题,状压里面都是用位运算来完成的,只要耐下心来弄明白每次位运算的含义,还是容易理解的。题意:有编号为0~n-1的n台服务器,每台都运行着n中服务,每台服务器还和若干台其他服务器相连。对于每台服务器,你可以选择停止该台以及与这台服务器相连的服务器的一项服务。如果一台服务器的所有...
分类:
其他好文 时间:
2014-08-13 21:29:47
阅读次数:
212
压前两行的状态很容易想到,但是 直接搞 (1(1#include #include #include #include #include #include #include #include #include #include #include #include using namespace .....
分类:
其他好文 时间:
2014-08-13 14:23:46
阅读次数:
140