- liangzexian's blog
递归公式
- 2023-3-13 10:00:54 @
1.最大公约数
2.快速幂
龟速法:
那么 时,
时,
快速法:
那么 时,
为偶数时,
为奇数时,
gcd(a,b)=a,if b=0
gcd(a,b)=gcd(b,a%b),if b=0
f(n)=an%c
那么 n=0 时, f(n)=1%c
n=0 时, f(n)=f(n−1)∗a%c
那么 n=0 时, f(n)=1%c
n 为偶数时,f(n)=f2(n/2)%c
n 为奇数时,f(n)=f(n−1)∗a%c
By signing up a HFOJ universal account, you can submit code and join discussions in all online judging services provided by us.