I have just started solving problems in Hackerrank, and my code did not even pass sample test cases,it gets "Run Time Error". Supposedly, it waits for the new line character on stdin and that is why doesn't output the result.
For example, for the following input case: 1 1 1 1 1 1 1 1 1 1 1 ........
It will wait until cursor goes to the next line.
that is the link to the problem: https://www.hackerrank.com/challenges/find-point
import java.util.Scanner;
public class FindPoint {
public static void main(String[] args){
Scanner input =new Scanner(System.in);
int testCases = input.nextInt();
int [] points = new int [4 * testCases];
int x = 0;
int y = 0;
int i = 0;
while(i < testCases){
points[i] = input.nextInt();
points[i + 1] = input.nextInt();
points[i + 2] = input.nextInt();
points[i + 3] = input.nextInt();
x = 2*points[2 + i] - points[0 + i];
y = 2*points[3 + i] - points[1 + i];
System.out.println(x + " " + y);
i++;
}
input.close();
}
}