#include <bits/stdc++.h>
using namespace std;
int n,b;
int work(int b){//注意这儿不能写do(int b);do while
if( b==1) return n;
int temp = work( b/2) ;// temp是临时的变量
temp = temp * temp;
if( b%2==1) temp = temp * n;
return temp;
}
int main(int argc, char** argv) {
cin >> n >> b;
cout<<n<<"^"<<b<<"="<< work(b);
return 0;
}
求b的n次方
最新推荐文章于 2021-03-02 08:20:40 发布