!-- Loading 底层遮罩 -->

快速幂

快速幂模板

int  FastPow (int base,int top)
{
     int  res = 1;
     while ( top ) {
         if (top % 2) res * =  base ;
         base * =  base ;
         top / =  2 ;
     }
     return   res ;
}
 

 

posted @ 2022-03-30 19:30  Thinker-X  阅读(21)  评论(0)    收藏  举报