I cannot understand why one of the test cases is showing wrong ans
Here is the code-
import java.util.*;
import java.lang.Math;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
for(int i=0;i<t;i++){
long n = scn.nextLong();
long k = scn.nextLong();
System.out.println((long)(Math.pow(n,1.0/k)));
}
}
}
KTH ROOT test case issue
import java.util.*;
import java.lang.Math;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
for(int i=0;i<t;i++){
long n = scn.nextLong();
long k = scn.nextLong();
//System.out.println((long)(Math.pow(n,1.0/k)));
// pow fun default arguments type double
System.out.println((long)(Math.pow(n,(float)(1.0/k))));
}
}
}