We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Same problem with me, though this would be my main()-Method (Java)... and by now I found the mistake due to another post. (Damn it's one of those really simple mistakes.):
Scanner scan = new Scanner(System.in);
int x1, x2, x, v1, v2, v;
long n;
String result = "NO";
x1 = scan.nextInt();
v1 = scan.nextInt();
x2 = scan.nextInt();
v2 = scan.nextInt();
x = x1 - x2;
v = v2 - v1;
n = x / v;
if ((n > 0) && (n * v == x)){
result = "YES";
}
System.out.println(result);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Number Line Jumps
You are viewing a single comment's thread. Return to all comments →
Same problem with me, though this would be my main()-Method (Java)... and by now I found the mistake due to another post. (Damn it's one of those really simple mistakes.):