11. Question 4
India has organized a blind folded ball passing game for two players.
They have a special kind of ground where player B can throw the ball in any
four directions (up, down, right, left).
The ground consists of some slant poles on which, when the ball strikes the
ball changes its direction by 90 degrees.
Consider the below field of 2 x 2 where the ball is at location 0,0 and being
thrown to its right. After hitting slant pole "", it will change direction and go
to 1,1.
B
- -
12. Question 4
If suppose you have thrown a ball in a direction in which there is no pole
then the ball goes out of the stadium in that direction.
Player B has the ball initially. The objective is to output the minimum steps
in which B can pass the ball to A and also the count of poles the ball has
struck.
If he can never pass the ball to A, then your output should be -1.
If you get multiple minimum steps then output those steps in which the ball
hits minimum no of barriers
13. Question 4
Input Format:
First line containing the integer K indicating the size of the field
Next two lines each having a pair of integers separated by space giving the
row and column numbers of
the positions of A and B respectively K lines of K integers each, separated
by space, giving the positions of
the barriers in the field - 0 indicating no barrier, 1 indicating a / barrier and 2
indicating a barrier.
Output Format:
Minimum number of steps required for the ball to reach A
Number of barriers ball on which the ball bounces
Output:
True
false
Description:
Here in the first output statement, the '*' takes the preceding value 'a' as its value and compares with the given string. Therefore, it gives the output as true. Whereas in the second case, '*' takes its value as 'a' and gets compared with 'k' in the given string. Hence, it gives the result as false.