Home > Back-end > Help bosses! (power conversion to quickly add more quickly)
Help bosses! (power conversion to quickly add more quickly)
Time:09-30
For a power of 2 to take more than b, because b is very large, with long long in the multiplication will overflow, so find the a power of 2, to add the fast power (multiplication) into fast (still seek a power of 2), is there a big yes (????? ︿??? ) Thank you!!!
CodePudding user response:
A, b, c, d; A==b + c; Namely: a % d==% d % d + c (b) % d Pow (2, n)=(2, n - 1) +=pow pow (2, n - 1); Pow (2, n) % d==((pow (2, n - 1) % d) * 2) % d. Decomposition is, just like that