想知道这个题为什么题解都这么复杂,翻了之前的AC代码也是基础方法解的
#include<bits/stdc++.h> using namespace std; long long ans=1; int a,b; int main(){ cin>>a>>b; for(int i=1;i<=b;i++){ ans*=a; if(ans>1e9){ cout<<-1; return 0; } } cout<<ans; return 0; }
题目传送门 题解传送门