int getRes(int a,int n){ int res=1; while(n>0){ if(n&1) res*=a; a*=a; n>>=1; } return res;}//该片段来自于http://www.codesnippet.cn/detail/090820135063.html
来源: http://www.codesnippet.cn/detail/090820135063.html