![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
acwing
Zaller
acm退休,考研ing...
无偿给同校学弟学妹们解答;
博客若有看不懂的或者不对的地方,直接私信我就行(如果我回复晚了,对不起都是我的错);
不用太客气等我回复,有问题直接私信发:)
ps: 随缘上线
展开
-
背包问题求方案数
题解AcWing 11. 背包问题求方案数原创 2020-04-16 19:42:11 · 156 阅读 · 0 评论 -
背包问题求具体方案
题解AcWing 12. 背包问题求具体方案#include <bits/stdc++.h>using namespace std;const int N = 1e3 + 10;int n, m, K;int f[N][N];int g[N][N];int v[N], w[N];int main() { ios::sync_with_stdio(0);...原创 2020-04-06 21:07:31 · 347 阅读 · 0 评论 -
DP - 最长上升子序列模型 (最长上升子序列 + 最长公共子序列)
dp - 最长上升子序列模型#include <bits/stdc++.h>using namespace std;const int INF = 0x3f3f3f;typedef long long ll;const int N = 1e6 + 10;int n, m, K;int a[N];int dp[N];int main() { ios::sync...原创 2020-04-02 20:02:43 · 235 阅读 · 0 评论 -
【模板】组合数
Cnm=Cn−1m−1+Cn−1mC^{m}_{n}=C^{m-1}_{n-1}+C^{m}_{n-1}Cnm=Cn−1m−1+Cn−1m// n 2e3 // O(n*n)#include <bits/stdc++.h>using namespace std;const int N = 2e3 + 10;int n, m, k;int C[N][N];voi...原创 2020-03-18 21:49:30 · 168 阅读 · 1 评论 -
斐波那契前 n 项和 · 矩阵快速幂
题解#include <bits/stdc++.h>using namespace std;typedef long long ll;int n, m, K;namespace Matrix {//矩阵快速幂板子 const int maxn = 3; int mod; struct Mat { ll mat[maxn][...原创 2020-03-15 12:28:34 · 258 阅读 · 0 评论 -
P1495 【模板】中国剩余定理(CRT)/曹冲养猪
题解原创 2020-03-12 19:37:41 · 326 阅读 · 1 评论 -
有向图的拓扑序列
由于有输出要求,所以用数组更加方便#include <bits/stdc++.h>using namespace std;typedef long long ll;const int N = 1e6 + 10;vector<int> g[N];int n, m, K;int d[N],q[N];bool topo() { int h = 0; ...原创 2020-03-09 22:15:11 · 337 阅读 · 0 评论 -
树的重心
定义树的重心也叫树的质心。对于一棵树n个节点的无根树,找到一个点,使得把树变成以该点为根的有根树时,最大子树的结点数最小。换句话说,删除这个点后最大连通块(一定是树)的结点数最小。剩余的节点必然不超过原来的n/2。性质树中所有点到某个点的距离和中,到重心的距离和是最小的,如果有两个重心,他们的距离和一样。把两棵树通过一条边相连,新的树的重心在原来两棵树重心的连线上。一棵树添加或者删...原创 2020-03-07 22:55:16 · 208 阅读 · 0 评论 -
八码数 · 哈希+BFS
题解#include <bits/stdc++.h>using namespace std;typedef long long ll;#define between(x, a, b) (a<=x && x<=b)const int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};const int N = 1e...原创 2020-03-07 21:30:27 · 179 阅读 · 0 评论 -
N皇后 · DFS
#include <bits/stdc++.h>using namespace std;int n, m, K;char mp[15][15];int a[15], b[15], c[15];void dfs(int u) { if (u == n) { for (int i = 1; i <= n; ++i) { pu...原创 2020-03-07 21:31:04 · 90 阅读 · 0 评论