摘要: #include<stdio.h>#include<vector>#include<string.h>#include<queue>#include<iostream>using namespace std;#define N 2000__int64 C=(__int64)1<<60;vector<__int64>pn[N],sn[N];vector<char>vn[N];queue<__int64>que;__int64 dp[N][4][2];__int64 bj[N];__int6 阅读全文
posted @ 2012-08-15 21:01 zhuiy 阅读(136) 评论(0) 推荐(0) 编辑
摘要: /*简单dp加单调队列*/ #include<stdio.h>#include<string.h>int N,M,D,S;int ac[6000];int dp[2][6000];int qu[6000];void fc(){ int i,k,j,l,cnt; for(i=0;i<M;i++) { cnt=i%2; qu[0]=1; k=0;j=0; for(l=1;l<=N;l++) { while(k<=j&&dp[cnt][qu[j]]<=dp[cnt][l]) ... 阅读全文
posted @ 2012-07-25 12:02 zhuiy 阅读(131) 评论(0) 推荐(0) 编辑
摘要: /*http://acm.uestc.edu.cn/problem.php?pid=1711&cid=169题意:岛上有n种宝藏,每一种宝藏有x个,它的价值为2^a。(x<10^9,a<10^5)现在给出n种宝藏的个数x和价值a,要你将它分成两份是它们差值最小并输出差值。思路:开始以为是背包问题,但是做不出来,正确的做法是:跟它的价值是2的次方有关系。假如宝藏有x个,而x是个奇数,那么没办法我们只能把一边多分一个2^a(先保存好,等下再讨论分给谁)。剩余的我们不分把她它弄成是(x/2)个价值为2^(a+1)的宝藏。(这里我们需要从a最小的开始)这样一直往上推,把宝藏弄成全部 阅读全文
posted @ 2012-07-24 15:08 zhuiy 阅读(317) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3397 阅读全文
posted @ 2012-07-17 21:28 zhuiy 阅读(137) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4186 阅读全文
posted @ 2012-07-10 21:54 zhuiy 阅读(212) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4180 阅读全文
posted @ 2012-07-10 21:29 zhuiy 阅读(186) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1754 阅读全文
posted @ 2012-07-10 09:16 zhuiy 阅读(116) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1698 阅读全文
posted @ 2012-07-10 09:14 zhuiy 阅读(158) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1166 阅读全文
posted @ 2012-07-10 09:12 zhuiy 阅读(107) 评论(0) 推荐(0) 编辑