Discussion About KTH ROOT

This is Discussion thread about KTH ROOT

Here is my code, giving wrong answer, i am using binary search. I don’t know whats wrong. can someone please help me.
que link: https://hack.codingblocks.com/app/contests/c/925/p/274
#include<bits/stdc++.h>
using namespace std;

int main() {

int t; cin>>t;
while(t--){
    int n,k;
    cin>>n>>k;
    //binary search 0 to n
    long st=1, end = n, mid = 0, ans = -1;
    while(st<=end){
    	mid =  (end+st)/2;
        long  p = pow(mid,k);
        // cout<<mid<<" :mid\n";
        if(p<=n){
            ans = mid;
            st = mid+1;
        }else{
            end = mid-1;
        }
    }
    cout<<ans<<"\n";

}
return 0;

}