看不懂评论区
查看原帖
看不懂评论区
163369
NewSoul_楼主2021/10/22 10:52

做法都好高级啊

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,ans;
	cin>>n>>m;
	if(m==1)
	{
		cout<<n;
	    return 0;
	}
	for(int x=0;pow(x,m)<n||pow(x,m)==n;x++)
		ans=x;
	cout<<ans;
	return 0;
		
}

快速幂啥得真没必要,直接一个循环就完事了

2021/10/22 10:52
加载中...