0101a^b
Fast power template, write about fast power principle.
We know a number \ (n \) in binary (may also be other band) may be under represented as \ (a_1 + a_2 * 2 ^ 1 + a_3 * 2 ^ 2 + ... + a_m * 2 ^ { }. 1-m \) . Then we can consider splitting it into every state in the binary, then do exponentiation. The time complexity of doing so is \ (O (n-log_2) \) .
Implementation process similar to reverse the partition (of course it can also directly implement partition), based on the following principle equation.
For k is even, \ (n-k = ^ (^ n-2) ^ (k / 2) \)