竞赛
考级
#include <bits/stdc++.h> using namespace std; int main(){ int a,b; int sum=1; cin>>a>>b; sum=pow(a,b); if(sum<0){ cout<<-1; return 0; } cout<<sum; return 0; }
只莹
include<bits/stdc++.h> using namespace std; int main(){ unsigned long long d=1000000000; int a,b; cin>>a>>b; unsigned long long sum=1; for(int i=1;i<=b;i++){ sum*=a; if(sum>d){ cout<<-1; return 0; } } cout<<sum; return 0; }
嫌疑を避ける ~~
#include<bits/stdc++.h> using namespace std; int main() {int a,b;cin >> a >> b;long long mul=1;for (int i=1;i<=b;i++){mul=mul*a;if (mul>1000000000){cout << "-1" << endl;return 0;}}cout << mul << endl;return 0;} 加油,奥力给!
Zhang Yixuan
来自互联网的疯子
bits/stdc++.h
空降坐标:CP003437 来源:CSP-J 2022 请看代码
LiWei
注:1eN = 10的N次方
zhouty
潜龙暗虎
#include<bits/stdc++.h> using namespace std; int main(){ }
rose
Eren.
复仇者_114514(互关
胡则鸣小号
#include<iostream> using namespace std; int main(){ long long a,b,c=1; cin >> a >> b; for(int i=0;i<b;i++){ c*=a; if(c>1000000000){ cout << "-1"; return 0; } } cout << c; return 0; }
187****1905
Em0ty
#include<iostream> #include<cmath> using namespace std; int main(){ long long n , m; cin >> n >> m; int num = n; long long limit = pow(10,9); for(int i = 2;i <= m;i++){ n *= num; if(limit < n){ cout << -1; return 0; } } cout << n; return 0; }
DARK SPECTRE
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; long long n=1; cin>>a; cin>>b; for(int i=1;i<=b;i++){ n=n*a; if(n>1000000000){ cout<<"-1"<<endl; return 0; } } cout<<n<<endl; return 0; }
风中雪zLyXj
#include<bits/stdc++.h> using namespace std; //int main(){ int a,b; cin >>a>>b; long long n=1; for (int i=1;i<=b;i++){ n=n*a; if (n>1000000000){ cout << "-1" << endl; return 0; } } cout << n << endl; return 0; }
吃菠萝的小琅_ด้้้้้็้้
#include<bits/stdc++.h> using namespace std; int main() { int a,b; cin >> a; cin >> b; long long mul=1; for (int i=1;i<=b;i++) { mul=mul*a; if (mul>1000000000) { cout << "-1" << endl; return 0; } } cout << mul << endl; return 0; }
菜
6.
耐高总冠军 张文杰
共45条