diff --git a/bin/Lost Robot/Solution.py b/bin/Lost Robot/Solution.py new file mode 100644 index 0000000..e314a03 --- /dev/null +++ b/bin/Lost Robot/Solution.py @@ -0,0 +1,15 @@ +#According to question we can only instruct robot up or down or left or right. So in his current coordiantes and home coordinates one of the/ +#coordinate either X or Y must be same. +for _ in range(int(input()): + x1,y1,x2,y2=map(int,input().split())#This will parse input to x1,y1,x2 and y2 + if x1!=x2 and y1!=y2: + print('sad') + elif x1==x2 and y1y2: + print('down') + elif y1==y2 and x1x2: + print('left') + diff --git a/bin/Lost Robot/quiz b/bin/Lost Robot/quiz new file mode 100644 index 0000000..02f35da --- /dev/null +++ b/bin/Lost Robot/quiz @@ -0,0 +1,34 @@ + +Robot Bunny is lost. It wants to reach its home as soon as possible. Currently it is standing at coordinates (x1, y1) in 2-D plane. +Its home is at coordinates (x2, y2). Bunny is extremely worried. Please help it by giving a command by telling the direction in which it +should to go so as to reach its home. If you give it a direction, it will keep moving in that direction till it reaches its home. +There are four possible directions you can give as command - "left", "right", "up", "down". It might be possible that you can't instruct +the robot in such a way that it reaches its home. In that case, output "sad". + +Input +First line of the input contains an integer T denoting the number of test cases. T test cases follow. + +First line of each test case contains four space separated integers x1, y1, x2, y2. + +Output +For each test case, output a single line containing "left" or "right" or "up" or "down" or "sad" (without quotes). + +Constraints +1 ≤ T ≤ 5000 +0 ≤ x1, y1, x2, y2. ≤ 100 +It's guaranteed that the initial position of robot is not his home. +Example + +Input +3 +0 0 1 0 +0 0 0 1 +0 0 1 1 + +Output: +right +up +sad + +Explanation +Test case 1. If you give Bunny the command to move to the right, it will reach its home.