摘要: 如何计算a^b mod c? 当a, b可能会比较大的时候。我们都知道公式(a*b)%c=(a%c)*(b%c)%c。推导出蒙哥玛利模幂算法:待续 b%=m; int result=1; while(e>0) { if( e&1 == 1 ) result = (result*b)%m; // multiply in this bit's contribution while using modulus to keep result small // move to the next... 阅读全文
posted @ 2012-09-10 22:13 xxx's blog 阅读(232) 评论(0) 推荐(0) 编辑