本题题意为给一个n,一个p,求k,使得k的n次方等于p,由于没有卡精度,直接用double计算即可。
代码如下:
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
double n,p;
int main()
{
while(scanf("%lf%lf",&n,&p)!=EOF)
{
double tp = log2(p);
double t = tp / n;
double r = pow(2,t);
int res = (int)(r+0.5);
printf("%d\n",res);
}
return 0;
}