Please check my code and tell me the about the failing test cases. I have checked the border cases but can’t find the problem.
#include
using namespace std;
long long int power(long int a,long int k)
{
if(k>0)
{
long long int ans = power(aa,k/2);
if(k%2)
ans=a;
return ans;
}
else
return 1;
}
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
long long int n,k;
cin>>n>>k;
long long int d=2,ans;
while(1)
{
ans=power(d,k);
if(ans>n)
break;
d++;
}
cout<<d-1<<endl;
}
return 0;
}