标签:scanf opened display lld -- turn while stdio.h efi
普通的快速幂,用于矩阵的版本稍后更新
1 #include<stdio.h> 2 #define lll long long 3 lll ksm(int,int); 4 int x,n; 5 int main() 6 { 7 scanf("%d%d",&x,&n); 8 printf("%lld",ksm(x,n)); 9 return 0; 10 } 11 lll ksm(int x,int n) 12 { 13 lll ret = x; n--; 14 while(n) 15 { 16 if(n & 1) ret *= x; 17 x *= x; 18 n >>= 1; 19 } 20 return ret; 21 }
标签:scanf opened display lld -- turn while stdio.h efi
原文地址:http://www.cnblogs.com/hzs2000/p/6708359.html