2018年7月27日

poj 2288 Islands and Bridges——状压dp(哈密尔顿回路)

摘要: 题目:http://poj.org/problem?id=2288 不知为什么记忆化搜索就是WA得不得了! #include<iostream> #include<cstdio> #include<cstring> #define ll long long using namespace std; 阅读全文

posted @ 2018-07-27 18:26 Narh 阅读(192) 评论(0) 推荐(0) 编辑

bzoj 1024 [SCOI2009]生日快乐——模拟

摘要: 题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1024 可以枚举这边放多少块、那边放多少块。 注意精度。不要每次用x*y/base算有多少块,传参较好。 阅读全文

posted @ 2018-07-27 16:50 Narh 阅读(153) 评论(0) 推荐(0) 编辑

bzoj 3231 [Sdoi2008]递归数列——矩阵乘法

摘要: 题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3231 矩阵乘法裸题。 1018是10^18。别忘了开long long。 阅读全文

posted @ 2018-07-27 16:17 Narh 阅读(181) 评论(0) 推荐(0) 编辑

hdu 5823 color II——子集dp(独立集)

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=5823 独立集染一种颜色。在这个基础上枚举子集来dp。 状压一样地存边真是美妙。 2^32是1ll<<32,不是1<<31。 阅读全文

posted @ 2018-07-27 15:31 Narh 阅读(192) 评论(0) 推荐(0) 编辑

bzoj 1093 [ZJOI2007]最大半连通子图——缩点+拓扑

摘要: 题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1093 缩点+拓扑,更新长度的时候维护方案数。 结果没想到处理缩点后的重边,这样的话方案数会算多。 学习人家处理重边的方法好好。 阅读全文

posted @ 2018-07-27 10:49 Narh 阅读(186) 评论(0) 推荐(0) 编辑

洛谷 3959 宝藏——枚举+状压dp

摘要: 题目:https://www.luogu.org/problemnew/show/P3959 原来写了个不枚举起点的状压dp。 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define ll l 阅读全文

posted @ 2018-07-27 09:26 Narh 阅读(188) 评论(0) 推荐(0) 编辑

导航