线性逆元

若求x关于p的逆元
设p=ax+b
则 a
x=-b(mod p)
所以 x-1=-ab-1
递推式 inv[x]=(p-p/x)
inv[p%x]

posted @ 2018-11-21 20:29  hjmmm  阅读(126)  评论(0编辑  收藏  举报