
BSGS
Amber_lylovely
这个作者很懒,什么都没留下…
展开
-
洛谷 P3846 [TJOI2007] 可爱的质数 bsgs
题目网址:https://www.luogu.com.cn/problem/P3846分析:一道bsgs的模板题。代码:#include <iostream>#include <cstdio>#include <cmath>#define LL long longconst int c=1e6+7; using namespace std;int p,b,n;struct node{ int x,y;}hash[c];void原创 2020-08-19 09:09:12 · 157 阅读 · 0 评论 -
bzoj 3239: Discrete Logging BSGS
DescriptionGiven a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 2 <= N < P, compute the discrete logarithm of N, base B, modulo P. That is, find an integer L such thatBL == N (mod原创 2018-03-11 19:51:31 · 213 阅读 · 0 评论 -
洛谷 P2485 [SDOI2011]计算器 exgcd+BSGS
题目描述你被要求设计一个计算器完成以下三项任务:1、给定y、z、p,计算y^z mod p 的值;2、给定y、z、p,计算满足xy ≡z(mod p)的最小非负整数x;3、给定y、z、p,计算满足y^x ≡z(mod p)的最小非负整数x。为了拿到奖品,全力以赴吧!输入输出格式输入格式: 输入文件calc.in 包含多组数据。第一行包含两个正整数T、K,分别表示数据组数和询问类型(对于一个测试点内原创 2018-03-25 21:13:10 · 190 阅读 · 0 评论 -
bzoj 1420: Discrete Root BSGS+原根
Description已知k,a,p,求x ^ k=a (mod p)的所有根(根的范围[0,p-1]Input三个整数p,k,a。0 < = a < p < = 10^9, 2 < = k < = 100000Output第一行一个整数,表示符合条件的x的个数。 第二行开始每行一个数,表示符合条件的x,按从小到大的顺序输出。 Sample Input11 3 8 Sample Output原创 2018-04-13 19:08:26 · 263 阅读 · 0 评论