Doubt regarding kth root

#include
#include

using namespace std;

int main() {
long long n,k;
long long t;
cin>>t;
for(long long i=0;i<t;i++){
cin>>n>>k;
long long s=1;
long long e=n;
long long ans =-1;

	while(s<=e){
	long long  mid=(s+e)/2;
		
		if(k*log10(mid)<=(log10(n))){
			ans =mid;
			s=mid+1;
		}
		else{
			e=mid-1;
		}
	}
	cout<<ans<<endl;
}
return 0;

}
when im taking log base as e why it doesnt pass 1 test case
with base 2 and 10its passing all test cases

I have edited your code… Try to submit now…I have used power function for the same…