QuickPower快速幂
#include <iostream> #include <cstdio> using namespace std; int a,b; long long qp(int a,int b) { int t=1;int y=a; while (b) { if (b&1) t=t*y;//whether odd or not y=y*y; b=b>>1; //cout << a << " " << b << " " << t << " " << y << endl; } return(t); } int main() { scanf("%d %d",&a,&b); printf("%lld",qp(a,b)); }