具体问题:a=10,b=9时输出999999999
考场上a=10 b=9输出都是正常的,一回到家里测就不正常了,这是咋回事啊
附上考场代码:
#include<bits/stdc++.h> using namespace std; int a,b; int main(){ // freopen("pow.in","r",stdin); // freopen("pow.out","w",stdout); cin>>a>>b; if(pow(a,b)>1e9) cout<<-1; else{ int kkksc03 = pow(a,b); cout<<kkksc03<<endl; } return 0; }