2013年5月13日

摘要: #include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>#define max( a,b ) ( (a)>(b)?(a):(b) )using namespace std;long long N,M,dp[12][4097];void DFS( int sta, int c,long long stu,long long ans ){ if( sta >= M )return; DFS( sta+1,c,stu,ans ); if( !(stu&am 阅读全文
posted @ 2013-05-13 13:43 浪舟 阅读(201) 评论(0) 推荐(0) 编辑
摘要: http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1160#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>usingnamespacestd;intmain(){intT,res;longlongN;scanf("%d",&T);while(T--){scanf("%I64d",&N);res=0;while(N){if(N%2 阅读全文
posted @ 2013-05-13 13:42 浪舟 阅读(328) 评论(0) 推荐(0) 编辑
摘要: http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1159因为只有加点 没有删点 所以线段树维护#include<iostream>#include<stdio.h>#include<cstring>#include<string>#include<algorithm>usingnamespacestd;structdate{intlt,rt,val,pre;}node[412345];boolvis[112345];voidbuild_tree(intlt,in 阅读全文
posted @ 2013-05-13 13:05 浪舟 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 链接http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1163#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>using namespace std;char str[1200],cha[1200],pat[1200],next[1200];int sta;void get_next( char *word ){ int len = strlen( word ); int k = - 阅读全文
posted @ 2013-05-13 12:57 浪舟 阅读(164) 评论(0) 推荐(0) 编辑

2013年5月5日

摘要: 题目链接 http://poj.org/problem?id=3254开始改变 自己写状态压缩的方式了 以前的那种写法 完全自创,很复杂一样;换了大牛的思路,,,不用 DFS 了#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>#define mod 100000000using namespace std;int N,M,ans,map[13],cnt[(1<<13)],dp[13][(1<<13)];void inint( ){ 阅读全文
posted @ 2013-05-05 19:47 浪舟 阅读(121) 评论(0) 推荐(0) 编辑

2013年5月4日

摘要: 注意 起点是 1 这个点#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>#define inf 0x1f1f1f1f#define min( x,y ) ((x)>(y)?(y):(x))using namespace std;int N,dis[12][12],dp[1<<11][11];int main( ){ int i,j,k; while( scanf("%d",&N) && N ) 阅读全文
posted @ 2013-05-04 12:57 浪舟 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 题意 经过任意一条边最多两次 遍历所有节点#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>#define inf 0x1f1f1f1fusing namespace std;int N,M,map[11][11],arr[32];int hash[12] = {0,1,3,9,27,81,243,729,2187,6561,19683,59049};int dp[177777][11];void work( int num ){ int k = 1; m 阅读全文
posted @ 2013-05-04 10:18 浪舟 阅读(156) 评论(0) 推荐(0) 编辑

2013年5月3日

摘要: 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=4544#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>#include<queue>using namespace std;struct date{ int val,harm; bool operator <( const date &a )const { return val < a.val; }}node[112345],t 阅读全文
posted @ 2013-05-03 19:50 浪舟 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 刘聪 集训队里面的一篇文章 (浅谈数位统计)如果大于1 后面的所有位都变成1 这是满足条件的能到达的最大值#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>using namespace std;int X,Y,K,B,arr[33],F[33][33];int work( int num ){ int i,j,t = num,k = 0; while( t ) { arr[k++] = t%B; t /= B; }... 阅读全文
posted @ 2013-05-03 19:47 浪舟 阅读(132) 评论(0) 推荐(0) 编辑
摘要: http://www.spoj.com/problems/SORTBIT/此题 有点难度,说实话;首先必须看一篇论文,(浅谈 数位统计)刘聪 然后就是每次右转时 进行一次统计;二分的时候 因为含有 len 个 1 的数量有很多,但呈现字典树上升的排列;所以可以二分;不断逼近#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>using namespace std;int N,M,K,F[32][32];int search( int n,int k ){ i 阅读全文
posted @ 2013-05-03 19:42 浪舟 阅读(171) 评论(0) 推荐(1) 编辑

导航