Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created July 14, 2020 06:51
Show Gist options
  • Save Abhayparashar31/65a57986fc9ff58332c1e029140d3f9a to your computer and use it in GitHub Desktop.
Save Abhayparashar31/65a57986fc9ff58332c1e029140d3f9a to your computer and use it in GitHub Desktop.
import math
import os
import random
import re
import sys
# Complete the kangaroo function below.
def kangaroo(x1, v1, x2, v2):
for n in range(10000):
if((x1+v1)==(x2+v2)):
return "YES"
x1+=v1
x2+=v2
return "NO"
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
x1V1X2V2 = input().split()
x1 = int(x1V1X2V2[0])
v1 = int(x1V1X2V2[1])
x2 = int(x1V1X2V2[2])
v2 = int(x1V1X2V2[3])
result = kangaroo(x1, v1, x2, v2)
fptr.write(result + '\n')
fptr.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment