2
摘要: /* 5 6 1 2 1 3 3 2 3 4 2 4 2 5 1 3 2 4 5 */ #include #include using namespace std; const int MAXN = 1000 + 10; int n, m; vector G[MAXN]; int du[MAXN]; int que[MAXN]; int main() { // read ... 阅读全文
posted @ 2018-02-07 20:06 DDYYZZ 阅读(406) 评论(0) 推荐(0) 编辑
摘要: 类似于枚举子集。 阅读全文
posted @ 2018-02-07 20:05 DDYYZZ 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 分析: 赌博,真的是一门艺术! 阅读全文
posted @ 2018-02-07 20:03 DDYYZZ 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1.输入输出 非常恐怖!!! 阅读全文
posted @ 2018-02-07 19:53 DDYYZZ 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 搜索是什么? 1.问题全状态空间 2.搜索空间 3.解路径 分类 一,盲目搜索(只是搜索的顺序不同) 1.深度优先搜索 2.宽度优先搜索 二,启发式搜索 A*算法 分类来讲 1.深度优先搜索 例题:皇后问题 存在的问题:1.深度问题,2.死循环问题 解决办法:1.对搜索深度加以限制 2.记录从初始状 阅读全文
posted @ 2018-02-07 19:50 DDYYZZ 阅读(784) 评论(0) 推荐(0) 编辑
摘要: 今天又一次听了动态规划,有些许感悟,所以想和大家分享一下 动态规划是什么? 是一种思想, 把问题逐渐变小,使我们通过一个式子就可以推出结果(在递推的基础上) 要点:1.方程式 2边界条件 3.状态之间的联系 分类 1.线性动规 2.背包动规 3.区间动规 4.树形动规 5DAG动规 下面我们分类来讲 阅读全文
posted @ 2018-02-07 19:08 DDYYZZ 阅读(925) 评论(0) 推荐(0) 编辑
摘要: /+++++++++++++++++++++++++++++++++++++++/ #include #include #include using namespace std; const int maxn = 10005; int a[maxn],b[maxn],c[maxn],ans[maxn],len_a,len_b,len_ans; void read(int *a,int &len)... 阅读全文
posted @ 2018-01-29 16:20 DDYYZZ 阅读(1542) 评论(0) 推荐(0) 编辑
摘要: 先向各位大佬介绍一个水题 任何一个正整数都可以用2的幂次方表示。例如 同时约定方次用括号来表示,即a^b 可表示为a(b)。 由此可知,137可表示为: 进一步:7= 2^2+2+2^0 (2^1用2表示) 所以最后137可表示为: 又如: 所以1315最后可表示为: 输入输出格式 输入格式: 一个 阅读全文
posted @ 2017-10-28 19:47 DDYYZZ 阅读(367) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; char s[400000]; //存储输入 struct Big { int a[10000]; int x; }; //重载 + Big operator + (Big A,Big B) { int x=max(A.x,B.x); for(int i=1;i=... 阅读全文
posted @ 2017-10-25 16:48 DDYYZZ 阅读(439) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include using namespace std; struct Tree//字典树 { int fail;//失配指针 int vis[26];//子节点的位置 int end;//标记有几个单词以这个节点结尾 }AC[1000000];//Tr... 阅读全文
posted @ 2017-10-24 16:59 DDYYZZ 阅读(746) 评论(0) 推荐(0) 编辑