My issue
The problem statement mentions the distance of point P must be calculated from the BOTTOM-RIGHT corner, but it seems the solutions are for top-right.
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import static java.lang.Math.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while (T-- > 0) {
int h = sc.nextInt();
int w = sc.nextInt();
int x = sc.nextInt();
int y = sc.nextInt();
int k = sc.nextInt();
int distance = (int) sqrt(
(pow(x - w, 2))
+ (pow(y - h, 2)));
System.out.println(distance < k ? 1 : 0);
}
}
}
Problem Link: CodeChef: Practical coding for everyone