Skip to content

Commit 1236767

Browse files
authored
Solution
1 parent f35b434 commit 1236767

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

HackerRank-Kangaroo/Kangaroo.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the kangaroo function below.
10+
def kangaroo(x1, v1, x2, v2):
11+
for n in range(10000):
12+
if((x1+v1)==(x2+v2)):
13+
return "YES"
14+
x1+=v1
15+
x2+=v2
16+
return "NO"
17+
18+
if __name__ == '__main__':
19+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
20+
21+
x1V1X2V2 = input().split()
22+
23+
x1 = int(x1V1X2V2[0])
24+
25+
v1 = int(x1V1X2V2[1])
26+
27+
x2 = int(x1V1X2V2[2])
28+
29+
v2 = int(x1V1X2V2[3])
30+
31+
result = kangaroo(x1, v1, x2, v2)
32+
33+
fptr.write(result + '\n')
34+
35+
fptr.close()

0 commit comments

Comments
 (0)