比赛 CSP2022普及组 评测结果 AAAAAATAAA
题目名称 乘方 最终得分 90
用户昵称 Benjamin 运行时间 1.000 s
代码语言 C++ 内存使用 0.57 MiB
提交时间 2022-10-29 14:43:40
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

int main()
{
	freopen("csp2022pj_pow.in","r",stdin);
	freopen("csp2022pj_pow.out","w",stdout);
	ull a,b,i=1,m=1e9,ans=1;
	cin>>a>>b;
	while(i<=b && !(ans>m))
	{
		ans *= a;
		i++;
	}
	if(ans<=m)
		cout<<ans<<endl;
	else
		cout<<-1<<endl;
	return 0;
}