NO~~~(70)
查看原帖
NO~~~(70)
1401899
aikepudelizhi楼主2024/9/29 20:23
#include<iostream>
using namespace std;
int x,y;
long long Pow(int a,int b){
    long long ans=1,base=a;
    while(b>0){
        if(b&1){
            ans*=base;
        }
        base*=base;
        b>>=1;
    }
    return ans;
}
int main(){
    cin>>x>>y;
    if(Pow(x,y)>1000000000){
        cout<<-1;
    }
    else{
        cout<<Pow(x,y);
    }
    return 0;
}
2024/9/29 20:23
加载中...