1 条题解
-
0
C++ :
#include<bits/stdc++.h> using namespace std; long long result = 1; int main(){ //freopen("pow.in","r",stdin); //freopen("pow.out","w",stdout); int a,b; cin>>a>>b; if(a == 1){ //如果a=1,b=10^9,会超时 cout<<1; return 0; } for(int i=1;i<=b;i++){ result *= a; if(result > pow(10,9)){ cout<<-1; return 0; } } cout<<result; return 0; }
- 1
信息
- ID
- 1807
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者