![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
BSGS
Ren_Ivan
衡中oier,fight for furture
展开
-
poj 3243 扩展BSGS
每次把gcd(a,c)提到前面,知道a,c互质,然后就是普通BSGS了 #include #include #include #include #include #define LL long long using namespace std; struct hashtable{ static const int N=577399; int tot,hash[N+10],key[N+5原创 2017-08-14 21:18:29 · 434 阅读 · 0 评论 -
bzoj 2242 [SDOI2011]计算器 快速幂+扩展欧几里得+BSGS
1:快速幂 2:exgcd 3:exbsgs,题里说是素数,但我打的普通bsgs就wa,exbsgs就A了...... (map就是慢)..... #include #include #include #include #include #include #define LL long long using namespace std; map pp; map bo; LL a,b,c;原创 2017-08-15 06:30:22 · 485 阅读 · 0 评论 -
bzoj 3239 poj 2417 BSGS
BSGS算法,预处理出ϕ(c)−−−−√\sqrt{\phi(c)}内的a的幂,每次再一块一块的往上找,转移时将b乘上逆元,哈希表里O(1)查询即可#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> #include<map> #define LL long long lo原创 2017-08-14 10:42:52 · 274 阅读 · 0 评论