摘要: DP综述 最优子结构:把原问题化到规模更小的问题后,原问题的最优解一定能从规模更小问题的最优解推出。 无后效性:如果在某个阶段上过程的状态已知,则从此阶段以后过程的发展变化仅与此阶段的状态有关,而与过程在此阶段以前的阶段所经历过的状态无关。 状态:类似搜索中所说的状态,就是怎么描述求解过程中的一个阶 阅读全文
posted @ 2022-10-24 15:55 Bertidurlah 阅读(79) 评论(1) 推荐(0)
摘要: 寒塘渡鹤影,冷月葬花魂。 阅读全文
posted @ 2022-10-24 15:34 Bertidurlah 阅读(23) 评论(0) 推荐(0)
摘要: 判定 一张图是二分图,当且仅当图中不存在奇环。 如果两个集合中的点分别染成黑色和白色,可以发现二分图中的每一条边都一定是连接一个黑色点和一个白色点。 例题:关押罪犯 #include<queue> #include<cstdio> #include<iostream> #include<algori 阅读全文
posted @ 2022-10-22 21:27 Bertidurlah 阅读(25) 评论(1) 推荐(0)
摘要: 警钟高支火兰 阅读全文
posted @ 2022-10-19 21:51 Bertidurlah 阅读(9) 评论(0) 推荐(0)
摘要: 模意义下乘法运算的逆元的求解方式 阅读全文
posted @ 2022-10-18 10:21 Bertidurlah 阅读(180) 评论(0) 推荐(0)
摘要: 欧拉函数 $O(\sqrt n)$求单个$\varphi(x)$的值 上公式: $$ \varphi(n)=n\times \prod_{i=1}^s\frac{p_i-1}{p_i} $$ 引理:若$p$为质数,则$\varphi(p^k)=p^k-p^{k-1}$ 因为与$p^k$不互质的只有$ 阅读全文
posted @ 2022-10-17 14:39 Bertidurlah 阅读(41) 评论(0) 推荐(0)
摘要: 高精乘低精&高精除低精 #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #define il inline #define ri register #define pc(i) putchar(i) u 阅读全文
posted @ 2022-10-15 19:18 Bertidurlah 阅读(28) 评论(1) 推荐(0)
摘要: 朱刘 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define il inline #define ri register #define pc(i) putchar(i) using name 阅读全文
posted @ 2022-10-15 19:16 Bertidurlah 阅读(26) 评论(1) 推荐(0)
摘要: #include<queue> #include<cstdio> #include<iostream> #include<algorithm> #define il inline #define ri register #define pc(i) putchar(i) using namespace 阅读全文
posted @ 2022-10-15 19:15 Bertidurlah 阅读(20) 评论(1) 推荐(0)
摘要: #include<cstdio> #define il inline #define ri register int #define ru register unsigned int #define ptn putchar('\n') #define max(a,b) ((a)>(b)?(a):(b 阅读全文
posted @ 2022-10-15 19:05 Bertidurlah 阅读(18) 评论(1) 推荐(0)