You are an IT developer, who works in a company that produces robots. Your robot
ID: 3672214 • Letter: Y
Question
You are an IT developer, who works in a company that produces robots. Your robots are designed to do certain work in a given area (for example, vacuum-clean a room). Each robot has a map of the area uploaded into its memory. The map is partitioned into rectangles, and at each moment any robot can either stay in its current rectangle or move to one of adjacent rectangles. If a charge of some robot fall below a critical level, and there is another robot in the area with a high charge, they should be programmed to meet so that one robot can recharge another robot. You are given a task to implement this feature. You are given a map and current rectangles of two robots as an input, and your algorithm should find a rectangle, where a meeting of robots can occur in a shortest possible time.
Explanation / Answer
let us consider the two robots are robo1 and robo2 and there are two rectangles r1,r2 .robo1 is in r1 and robo2 is in r2....
assumption:: all rectangles have same length and breadth***
now algorithm starts here:::::
1)first we will form the right angeled traingle with two vertices as the rectangles in which robos are placed and the other vertex will be the rectangle which will be formed by perpendicular lines from robos intersection
2) then we will compute the hypotenuse value which will define the number of rectangles between the two robos
3) now we will divide the value by 2 and then obtained value is the number of diagonals to be moved by each robo
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.