大佬们,给给思路吧。。。
40分代码:
#include<iostream>
using namespace std;
int main(){
long long a, b, s;
cin>>a>>b;
s = a;
if((a>10 && b>9) || (a>9 && b>10)){
cout<<-1<<endl;
}
else{
for(long long i=0; i<b; i++){
s *= a;
}
cout<<s<<endl;
}
return 0;
}
50分代码:
#include<iostream>
using namespace std;
int main(){
long long a, b, s;
cin>>a>>b;
s = a;
for(long long i=0; i<b; i++){
s *= a;
}
if(s>1000000000){
cout<<-1<<endl;
}
else{
cout<<s<<endl;
}
return 0;
}