自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 矩阵快速幂

//// Created by Sieak Softly on 2019-12-16.//#include "cstdio"#include "cstdlib"#include "iostream"#include "sstream"#include "cstring"#include "cmath"#include "algorithm"#include "queue"#...

2020-01-02 15:45:17 98

原创 广义a^b%c快速幂

LL quick_mul(LL a, LL b, LL c) { LL ans = 0; while (b) { if (b & 1) ans = (ans + b) % c; a = (a + a) % c; b >>= 1; } return ans;}LL quick_pow(LL a,...

2020-01-02 14:13:49 170

原创 主席树区间静态区间第k小--模板

//// Created by Speak Softly on 2019-06-29.//#include “cstdio”#include “cstdlib”#include “iostream”#include “cstring”#include “cmath”#include “algorithm”#include “queue”#include “map”#inclu...

2019-08-29 11:42:32 98

原创 线段树区间更新、区间查询模板

#include "iostream"#include "cstdio"#include "cstdlib"#include "cstring"#include "cmath"#include "algorithm"#include "queue"#include "vector"#include "stack"#include "map"#include "set"usin...

2019-08-06 18:04:07 136

原创 trie前缀模板

#include "iostream"using namespace std;const int maxn = 1000010, maxm = 500010;int n, m;int son[maxm][26], cnt[maxn], idx;char str[maxn];void insert() { int p = 0; for(int i = 0; str...

2019-08-06 18:03:28 93

原创 Hash模板

#include "iostream"#include "cstring"using namespace std;typedef unsigned long long ll;const int N = 10000010;char str[N];ll Hash[N], p[N];int main() { cin >> (str + 1); int...

2019-08-06 18:02:56 100

原创 tarjan割点模板

#include "iostream"#include "cstdio"#include "cstdlib"#include "cstring"#include "cmath"#include "algorithm"#include "queue"#include "vector"#include "stack"#include "map"#include "set"usi...

2019-08-06 18:02:23 106

原创 大数乘法&加法模板

洛谷P1009#include "iostream"#include "cstdio"#include "cstdlib"#include "cstring"#include "cmath"#include "algorithm"#include "queue"#include "vector"#include "stack"#include "map"#include "s...

2019-08-01 18:41:11 84

原创 根据中序、后序遍历求前序遍历

void f(string s1,string s2) { if(s1.size()) { char root = s2[s2.size() - 1]; cout << root; int n = s1.find(root); f(s1.substr(0, n), s2.substr(0, n)); f(s1.substr(n + 1), s2.substr(n,...

2019-08-01 13:54:33 282

原创 GCD模板&LCM

int GCD(int a, int b) { return b ? GCD(b, a % b) : a;}int LCM(int a, int b) { return a * b / GCD(a, b);}

2019-08-01 13:48:04 135

原创 N进制加法模板

string str1, str2;int a[maxn], b[maxn];int N;void sum(){ for(int i = str1.size() - 1, j = 0; i >= 0; --i, ++j) a[j] = str1[i] - 48; for(int i = str2.size() - 1, j = 0; i >= ...

2019-07-21 19:45:43 855

原创 埃氏筛选法O(n)

const int maxn = 1e8 + 1;int book[maxn];void prime(int n) { memset(book, true, sizeof book); book[1] = false; for(int i = 2; i <= sqrt(n); ++i) { if(book[i]) { for(int j = 2; j <= n ...

2019-07-13 12:28:02 167

原创 1-n全排列(递归&位)

#include "iostream"#include "vector"using namespace std;int n;vector<int> res;void dfs(int u, int v) { if(u == n) { for(auto x : res) { cout << x << " ...

2019-07-12 15:49:30 197

原创 1-n子集(递归)

#include "iostream"using namespace std;int n;int vis[20];void f(int i) { if(i == n) { for(int i = 0; i < n; ++i) { if(vis[i]) { cout << i + 1 &l...

2019-07-12 15:08:04 356 1

原创 1-n的子集(递归&位)

#include "iostream"using namespace std;int n;void f(int i, int j) { if(i == n) { for(int i = 0; i < n; ++i) { if(j >> i & 1) { cout << ...

2019-07-12 15:01:32 321

原创 lowbit

int lowbit(int n) { return n & -n; //n & (~n + 1)}

2019-07-12 14:42:54 62

原创 大数乘法取模运算

#include "iostream"using namespace std;typedef unsigned long long ll;int main() { ll a, b, p; cin >> a >> b >> p; ll res = 0; while(b) { if(b & 1) ...

2019-07-12 13:55:45 539

原创 快速幂模板

long long a, b, p;cin >> a >> b >> p;long long res = 1;while(b) { if(b & 1) { res = res * a % p; } a = a * a % p; b >>= 1;}cout << res % p << endl;...

2019-07-12 13:30:42 60

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除