
数论——BSGS算法
Alex_McAvoy
想要成为渔夫的猎手
展开
-
数论 —— 高次同余方程与 BSGS 算法
【概述】BSGS(BabyStepGiantStep)算法,又称大小步算法,其主要用于解形如的高次同余方程中的 x,其核心思想是分块。当 A与 C互质时,通过费马小定理:可知,当时,会出现一个循环节,于是就能保证答案 x若存在,必然有因此,当 C比较小时,可使用暴力,直接令从 0 枚举到 C-1,检验其是否为方程的解,而当 C比较大时,使用暴力会 TLE,...原创 2019-03-20 20:39:07 · 1081 阅读 · 0 评论 -
Discrete Logging(POJ-2417)
Problem DescriptionGiven a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 1 <= N < P, compute the discrete logarithm of N, base B, modulo P. That is, find an i...原创 2019-03-21 14:18:52 · 311 阅读 · 0 评论 -
Clever Y(POJ-3243)
Problem DescriptionLittle Y finds there is a very interesting formula in mathematics:X^Y mod Z = KGiven X, Y, Z, we all know how to figure out K fast. However, given X, Z, K, could you figure o...原创 2019-03-21 15:19:15 · 369 阅读 · 0 评论