考场时本地编译没问题。
评测记录
link
Code
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAX=1e9;
int base,index;
signed main()
{
freopen("pow.in","r",stdin);
freopen("pow.out","w",stdout);
cin>>base>>index;
int ans=1;
while(index)
{
if(index&1)ans*=base;
if(ans > MAX)return cout<< "-1",0;
base*=base;
index>>=1;
}
cout<< ans;
return 0;
}