摘要:
基础数论: 质数(一般用线性筛) 约数 快速幂 组合数 容斥 补题: C - Bacteria 救命,取栈顶元素没开long long,太可惜了 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int 阅读全文
摘要:
基础算法: 二分 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 2e5 + 10; int n, m; int a[N], b[N]; bool check(int x) { int 阅读全文
摘要:
dfs(尽可能往深搜)栈O(n) 顺序+剪枝 全排列 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=10; int path[N]; bool st[N]; int n; void df 阅读全文
摘要:
单调栈 GInger的神罚洛谷U220471 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int>pii; const int N=2e5+10; ll a[N],dp[N] 阅读全文
摘要:
islands dfs #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=55; char a[N][N]; int n,m,res; int dx[4]= {-1,0,1,0}; int 阅读全文
摘要:
bookshelf filling 二分,从右边的长度为b的书中选tt本,看上面剩下的空间能否摆下tt本。因为tt的值越小,越有可能摆下,所以满足二分的性质。 #include <bits/stdc++.h> using namespace std; typedef long long ll; co 阅读全文
摘要:
B #include <iostream> #include <algorithm> #include <cstring> #include <math.h> using namespace std; typedef long long ll; const int N=1e3+10; char s[ 阅读全文