#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; int pow(int x, int n) { int result = 1; while (n > 0) { if (n % 2==1) result *= x; x *= x; n /=2 ; } return result; } int main() { int n,m; while(~scanf("%d%d",&n,&m)) { int s = pow(n,m); printf("%d\n",s); } return 0; }
原文地址:http://blog.csdn.net/u013497151/article/details/27633731