随笔分类 - 模板题目
摘要:比较类排序 交换排序 冒泡排序 void bubble_sort(int arr[], int low, int high) { int len = high-low+1; for (int i = 0; i < len-1; ++i) { for (int j = 0; j < len-1-i;
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; int a[] = {0,1,3,3,5,6,7,8,9,20,21,21,21,30,41,41,41,41,41,45,60}; // 查找第一个大于等于x的位置 int lower_bound(int
阅读全文
摘要:hdu3397 Sequence operation 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 1e6+5; 4 struct node { 5 /// l,r表示当前结点区间范围[l,r] 6 int
阅读全文
摘要:P3834 【模板】可持久化线段树 1(主席树) 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 2e5+5; 4 int n, q, m, cnt = 0; 5 int a[maxn], b[maxn], T
阅读全文
摘要:P3389 【模板】高斯消元法 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 105; 4 typedef double Matrix[maxn][maxn]; 5 void gauss_eliminatio
阅读全文
摘要:P2613 【模板】有理数取余 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int p = 19260817; 5 inline ll read() { 6 ll res = 0;
阅读全文
摘要:P3386 【模板】二分图匹配 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 2005, inf = 0x3f3f3f; 4 struct Edge { 5 int from, to, cap, flow;
阅读全文
摘要:P3381 【模板】最小费用最大流 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 10005, inf = 0x3f3f3f3f; 4 struct Edge { 5 int from, to, cap, f
阅读全文
摘要:P3376 【模板】网络最大流 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 10005, inf = 0x3f3f3f; 4 struct Edge { 5 int from, to, cap, flow;
阅读全文
摘要:P5367 【模板】康托展开 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 1e6+5; 5 const int mod = 998244353; 6 ll n
阅读全文
摘要:P4526 【模板】自适应辛普森法2 1 #include <bits/stdc++.h> 2 using namespace std; 3 const double eps = 1e-8; 4 double a; 5 inline double f(double x) { 6 return pow
阅读全文
摘要:P4525 【模板】自适应辛普森法1 1 #include <bits/stdc++.h> 2 using namespace std; 3 const double eps = 1e-6; 4 double a, b, c, d, l, r; 5 inline double f(double x)
阅读全文
摘要:P4549 【模板】裴蜀定理 1 #include <bits/stdc++.h> 2 using namespace std; 3 int main() { 4 int n; scanf("%d",&n); 5 int ans; 6 for (int i = 1; i <= n; ++i) { 7
阅读全文
摘要:P1439 【模板】最长公共子序列 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 1e5+5; 4 int id[maxn]; 5 vector<int> ve; 6 int main() { 7 int n
阅读全文
摘要:POJ3903 Stock Exchange 1 #include <iostream> 2 #include <cstdio> 3 #include <vector> 4 #include <algorithm> 5 using namespace std; 6 const int maxn =
阅读全文
摘要:P5431 【模板】乘法逆元2 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 5e6+5; 5 int a[maxn], pre[maxn], suf[maxn
阅读全文
摘要:P3811 【模板】乘法逆元 本题只能用线性筛逆元,其他方法的话超时,不过还是写出来 线性筛逆元 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 3e6+5; 5
阅读全文
摘要:P5091 【模板】欧拉定理 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 ll qmul(ll a, ll b, ll mod) { 5 ll res = 0; 6 while (b) { 7
阅读全文
摘要:P4718 【模板】Pollard-Rho算法 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 typedef __int128 lll; 5 char buf[700000000]; 6 int
阅读全文
摘要:hdu2138 How many prime numbers 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 5 ll prime[6] = {2,3,5,233,331}; 6 ll qmul(
阅读全文

浙公网安备 33010602011771号