- 博客(17)
- 收藏
- 关注
转载 中国剩余定理
https://www.cnblogs.com/MashiroSky/p/5918158.html(拼凑自以上连接)备忘录:a|b是指a能整除b,a是b的因式,4|2是不成立的,2|4才成立lcm(a,b) a,b的最小公倍数中国剩余定理设正整数两两互素,则同余方程组有整数解。并且在模下的解是唯一的,解为...
2020-01-12 16:21:07
177
转载 乘法逆元
取模运算百度百科:https://baike.baidu.com/item/%E5%8F%96%E6%A8%A1%E8%BF%90%E7%AE%97/10739384?fr=aladdinhttps://blog.youkuaiyun.com/yu121380/article/details/81188274https://blog.youkuaiyun.com/a493823882/article/de...
2020-01-12 15:02:44
197
原创 扩展欧几里德(模板)
https://www.luogu.com.cn/problem/P1082https://blog.youkuaiyun.com/zhjchengfeng5/article/details/7786595https://blog.youkuaiyun.com/zero_from/article/details/52984044https://blog.youkuaiyun.com/weixin_44203780/art...
2020-01-11 10:06:25
173
转载 sg函数(模板)
另一篇文章推荐https://blog.youkuaiyun.com/cc_1012/article/details/88650732//f[N]:可改变当前状态的方式,N为方式的种类,f[N]要在getSG之前先预处理//SG[]:0~n的SG函数值//S[]:为x后继状态的集合int f[N],SG[MAXN],Hash[MAXN];void getSG(int n){ in...
2020-01-10 15:27:06
165
原创 tarjan模板
https://vjudge.net/problem/POJ-1236https://www.bilibili.com/video/av60380978#include<iostream>#include<cstdio>#include<algorithm>using namespace std;#define inf 0x3f3f3f3f#...
2019-11-30 17:12:42
92
转载 c++数字和字符串的转换
c++数字和字符串的转换转载自林汐------1 利用stringstream 添加头文件 #include<sstream> 数字转字符串#include <string> #include <sstream> int main(){ doublea =123.32;string re...
2019-06-28 20:45:24
154
转载 矩阵快速幂模板
快速幂(res的N次幂)long long QuickPow(int res,int N){ int ans = 1; while(N){ if(N&1) ans*=res; res*=res; N>>=1; } return ans;}矩阵快速幂(res的...
2019-06-14 19:49:56
104
转载 数据离散化处理(转载)
作者 Hengzuzong转载自https://blog.youkuaiyun.com/gao506440410/article/details/81908208 一、概述数据离散化是一个非常重要的思想。为什么要离散化?当以权值为下标的时候,有时候值太大,存不下。 所以把要离散化的每一个数组里面的数映射到另一个值小一点的数组里面去。打个比方,某个题目告诉你有10^4个数,每个数大小不超过1...
2019-06-02 19:56:29
489
转载 lower_bound( )和upper_bound( )
作者:brandong 原文:https://blog.youkuaiyun.com/qq_40160605/article/details/80150252 lower_bound( )和upper_bound( )都是利用二分查找的方法在一个排好序的数组中进行查找的。在从小到大的排序数组中,lower_bound( begin,end,num)从数组的begin位置到end-1位置二...
2019-05-18 15:30:00
242
翻译 Codeforces Round #560 (Div. 3) C. Good String
链接: http://codeforces.com/contest/1165/problem/Ctime limit per test 1 secondmemory limit per test 256 megabytesinputstandard inputoutputstandard outputLet's call (yet again) a string goo...
2019-05-17 20:12:29
231
转载 Educational Codeforces Round 65 (Rated for Div. 2) B. Lost Numbers
是从hh13579的博客中学来的 链接:https://www.cnblogs.com/hh13579/p/10873209.html题目 http://codeforces.com/contest/1167/problem/BThis is an interactive problem. Remember to flush your output while communicatin...
2019-05-16 19:44:04
217
转载 位运算
转载自https://blog.youkuaiyun.com/deaidai/article/details/78167367前言众所周知,位运算是我们学计算机必学的东西,前人用二进制、位运算给我们了一个操作简单的计算机,但我们却很少接触位运算了。今天介绍一些位运算在算法中的运用。位运算基础& 按位与 如果两个相应的二进制位都为1,则该位的结果值为1,否则为0 ...
2019-05-15 20:39:29
145
转载 拓扑排序模板加例题(拓扑排序问题汇总)转载
转自 傻子是小傲娇的博客出处 https://blog.youkuaiyun.com/love_phoebe/article/details/81660640概念:一个有向无环图的拓扑序列是将图中的顶点排成一个线性序列,使得对于图中任意一对顶点u,v。若存在边<u,v>,则线性序列中u出现在v之前。算法实现:(1)若图中的点入度均大于0则不存在拓扑序列,否则进行第二步(2)取一...
2019-05-14 20:19:09
146
翻译 优先队列(kuangbin)
STL 优先队列 priority_queueempty() 如果队列为空返回真pop() 删除对顶元素push() 加入一个元素size() 返回优先队列中拥有的元素个数top() 返回优先队列队顶元素 在默认的优先队列中,优先级高的先出队。在默认的 int 型中先出队的为较大的数。priority_queueq1;//大的先出对priority_queue,gre...
2019-05-10 15:45:54
141
翻译 KMP模板
KMP模板http://acm.sdut.edu.cn/onlinejudge2/index.php/Home/Index/problemdetail/pid/2772.html#include <bits/stdc++.h>using namespace std;char s1[1000005], s2[1000005];int nex[1000005];void ...
2019-05-10 15:37:46
119
原创 幷查集简单模板
模板#include <bits/stdc++.h>using namespace std;const int max_n = 1e5 + 10;int pre[max_n];int findf(int root){ if(root != pre[root]) pre[root] = findf(pre[root]);// 查找+压缩路径 ...
2019-05-05 10:25:53
122
转载 Non-Prime Factors (质数筛选+因子分解)
转载自丿不落良辰的博客https://cn.vjudge.net/problem/Kattis-nonprimefactorsNon-Prime Factors (质数筛选+因子分解)For example, integer 100has the following nine factors: {1,2,4,5,10,20,25,50,100}. The two which are u...
2019-05-03 20:00:34
431
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人