上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 48 下一页
  2012年7月18日
摘要: http://poj.org/problem?id=3373DFS+强力剪枝伤不起呀 自己写怎么都写不出来 最后还看开了别人的解题报告思维能力还是不够呀推荐解题报告:http://blog.csdn.net/lyy289065406/article/details/6698787代码及其注释:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<algorith 阅读全文
posted @ 2012-07-18 09:12 夜-> 阅读(162) 评论(0) 推荐(0) 编辑
  2012年7月17日
摘要: http://poj.org/problem?id=1724居然直接Dfs+剪枝就可以过 受不了啦!!!!!!!题目大意:n个城市间有单向路 路有长度和花费两个参数问在总花费不超过特定值的情况下从1到n的最短路 包括到不了的情况代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<algorithm>#include<set>using 阅读全文
posted @ 2012-07-17 11:39 夜-> 阅读(157) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3411题目大意:n城市 m条路(可能重)每条路两种情况付费 a b c p r如果已经经过了c城则可以付费p 否则只能付费r求从1到n最小花费思路:记录各种花费 然后Dfs枚举 但是本题某一点可以多次不过由于边的数量是最多10 所以某一个点最多经过4此(自己想吧 亲!)快乐深搜 注意n=1的情况#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<q 阅读全文
posted @ 2012-07-17 10:48 夜-> 阅读(176) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1699题目大意:给你n个字符串 可以让他们任意首尾合并相连求包含所以字符串的最短总字符串长度注意:只能首尾合并相连像 ACTG 和 CT 是不可以的思路:求出所以成对字符串合并会增加多少长度 并记录在表中然后Dfs搜索就可以啦 剪枝效果更好代码及其注释:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<a 阅读全文
posted @ 2012-07-17 09:08 夜-> 阅读(268) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2406题目同 poj 1961代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<algorithm>#include<set>using namespace std;const int N=1000010;char s[N];int next[N];int ans[N];void 阅读全文
posted @ 2012-07-17 08:01 夜-> 阅读(147) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1961此题直接上代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<algorithm>#include<set>using namespace std;const int N=1000010;char s[N];int next[N];int ans[N];void findnex 阅读全文
posted @ 2012-07-17 07:53 夜-> 阅读(131) 评论(0) 推荐(0) 编辑
  2012年7月16日
摘要: http://poj.org/problem?id=2492和poj 1703 一样不再多说代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<algorithm>#include<set>using namespace std;const int N=100010;int f[N];int same[N];int findf(int 阅读全文
posted @ 2012-07-16 20:29 夜-> 阅读(153) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1703题目大意:有一些罪犯,分两伙 每伙至少一个两种操作D a b:a和b不是一伙的A a b:a和b 之间的关系是什么思路:并查集,先把可以确定关系的罪犯放在一个集里 再多一个数组表示此节点和他指向的上一个节点是否一样(是否同伙)代码及其注释:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<algor 阅读全文
posted @ 2012-07-16 20:02 夜-> 阅读(158) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3264RMQ 模板题参考资料:http://wenku.baidu.com/view/53e2b6ed4afe04a1b071deb5.html代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<queue>#include<algorithm>#include<stack>using namespace std 阅读全文
posted @ 2012-07-16 09:56 夜-> 阅读(185) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3321题目大意:给你N个点组成的树 每个点初始化为1 有两种操作C x:改变点的值 是1变0 是0变1Q x:问以x为根的子树上点值的和思路:主要是把树映射到树状数组中一遍dfs把点重新编号 low和high low表示刚搜到此点时的计数,high是搜玩其子树内所有节点后回来的计数编号比如说又n个点那么根节点1的low=1,high=2*n这样就映射到树状数组中啦。代码及其注释:#include<iostream>#include<cstdio>#include<cstring>#include<s 阅读全文
posted @ 2012-07-16 08:44 夜-> 阅读(171) 评论(0) 推荐(0) 编辑
上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 48 下一页