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

快速幂

时间:2014-11-16 10:31:12      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:sp   on   bs   amp   nbsp   return   l   a   if   

long pow(int x,int t)

{

  long ans=1;

  while(t)

  {

if(t&1) ans=ans*x;

x*=x;

t=t/2;

     }

     return ans;

}

快速幂

标签:sp   on   bs   amp   nbsp   return   l   a   if   

原文地址:http://www.cnblogs.com/a972290869/p/4101065.html

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