Kth roots problem

sir mera code 10^6 k liya kyu nahi chal raha hai
#include
#include<math.h>
using namespace std;
int main()
{
long long int n;
long long int k;
cin>>n;
cin>>k;
long long int start=1;
long long int end=n;
long long int mid;
long long int d=0;
while(start<=end)
{
mid=(start+end)/2;
long long int x=pow(mid,k);
if(x<=n)
{
d=mid;
start=mid+1;
cout<<d<<endl;
}
else
{
end=mid-1;
}
}
cout<<d;
}

@YASHMATHURIA123 I will be replying on your another doubt for this same problem, so please mark this as resolved and talk there.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like