T1为什么这份代码90分呢
  • 板块灌水区
  • 楼主szhqwq
  • 当前回复13
  • 已保存回复13
  • 发布时间2022/10/29 15:58
  • 上次更新2023/10/27 05:09:56
查看原帖
T1为什么这份代码90分呢
638084
szhqwq楼主2022/10/29 15:58

rt

#include <bits/stdc++.h>

#define int long long

using namespace std;

const int N = 1e9;

int a,b;

inline int Pow(int a,int b) {
	int res = 1;
	for (int i = 1; i <= b; i ++ ) res *= a;
	return res;
}

signed main() {
	cin >> a >> b;
	if (a == 1) { cout << 1 << endl; return 0; }
	if (b == 1) {
		if (a <= N) cout << a << endl;
		else cout << "-1" << endl;
		return 0;
	}
	if (a >= 31623 || b >= 30) { cout << "-1" << endl; return 0; }
	
	cout << Pow(a,b) << endl;
    return 0;
}
2022/10/29 15:58
加载中...