-2

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();
 }
}
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
fiz
  • 389
  • 5
  • 26

1 Answers1

0

Change

public class FindPoint

to

class Solution

And make sure to select Java from the language list.

elgis
  • 478
  • 1
  • 5
  • 9