大佬们求助,看题解结合自己的差不多啊,为啥不对呢?(24小时内必回复)
查看原帖
大佬们求助,看题解结合自己的差不多啊,为啥不对呢?(24小时内必回复)
383027
Torbllino楼主2023/5/18 21:51
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	long long s=1;
	cin>>a>>b;
	if(a==1)
	{
		cout<<"1";	
		return 0;
	}
	for(int i=1;i<=b;i++)
	{
		s=s*a;
	}
	if(s>1e9)
	cout<<"-1";
	else cout<<s;
	return 0;
}
2023/5/18 21:51
加载中...