码迷,mamicode.com
首页 > 其他好文 > 详细

快速幂竞赛模板

时间:2019-07-21 01:45:46      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:pre   int   模板   快速   style   color   while   col   竞赛   

int ans=1;
while(n)
{
  if(n&1)
    ans=ans*x;
  x*=x;
  n>>=1;
}

求x^n

快速幂竞赛模板

标签:pre   int   模板   快速   style   color   while   col   竞赛   

原文地址:https://www.cnblogs.com/Tidoblogs/p/11219885.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!