int quickpow(int m,int n,int k){ int b = 1; while (n > 0) { if (n & 1) b = (b*m)%k; n = n >> 1 ; m = (m*m)%k; } return b;}
用2进制拆分理解这段代码
本文共 244 字,大约阅读时间需要 1 分钟。
int quickpow(int m,int n,int k){ int b = 1; while (n > 0) { if (n & 1) b = (b*m)%k; n = n >> 1 ; m = (m*m)%k; } return b;}
用2进制拆分理解这段代码
转载于:https://www.cnblogs.com/zy691357966/p/5480478.html