Last active
December 17, 2017 11:15
-
-
Save empeje/cbbdd585d1f8d72c8ea71a5ca3c3111b to your computer and use it in GitHub Desktop.
[SNIPPET-23] HackerRank - 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
#!/bin/python3 | |
import sys | |
def is_odd(integer): | |
if integer % 2 == 0: | |
return False | |
else: | |
return True | |
x1,v1,x2,v2 = input().strip().split(' ') | |
x1,v1,x2,v2 = [int(x1),int(v1),int(x2),int(v2)] | |
speed_insufficient = ((v1 == v2) & (x1 != x2)) or (((x1-x2) < 0) == ((v1-v2) < 0)) | |
if speed_insufficient: | |
print('NO') | |
elif (x1 - x2) % (v2 - v1) == 0: | |
print('YES') | |
else: | |
print('NO') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment