Kth root problem

#include
#include
#include
using namespace std;
bool ispossible(unsigned long int n,int k,int mid){
long int m=1;
for(int i=1;i<=k;i++){
m=m*mid;
if(m>n){
return false;
}
}
return true;
}
void print(unsigned long int n,int k){
int s=1,e=n,ans=0;
while(s<=e){
int mid=(s+e)/2;
if(ispossible(n,k,mid)){
ans=mid;
s=mid+1;
}
else{
e=mid-1;
}
}
cout<<ans;
}
int main() {
int t;
cin>>t;
for(int i=0;i<t;i++){
unsigned long int n;
int k;
cin>>n>>k;
if(k==1){
cout<<n;
}
else{
print(n,k);
}
cout<<endl;
}
return 0;
}

This code gives TLE. What is the problem here?

hi… just use directly binary search… refer this https://ide.codingblocks.com/s/599005

hi… are u still facing any issues with this question???

No, the problem is clear!!

ok… cool… so i am closing this doubt now

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.