Created
March 6, 2017 02:09
-
-
Save torpedo87/dc28b72460b6534ce4f64cbf20fca296 to your computer and use it in GitHub Desktop.
[kangaroo](https://www.hackerrank.com/challenges/kangaroo)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
var x1_temp = readLine().split(' '); | |
var x1 = parseInt(x1_temp[0]); | |
var v1 = parseInt(x1_temp[1]); | |
var x2 = parseInt(x1_temp[2]); | |
var v2 = parseInt(x1_temp[3]); | |
var n = (x2-x1)/(v1-v2); | |
if(Number.isInteger(n) && n>0){ | |
console.log("YES"); | |
}else{ | |
console.log("NO"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment