+ 6

solve this if u can(with a code..any language)

Caesar wishes to lay siege to the indomitable Gauls, and moves his catapults (hurling huge rocks) to all point in a line to the Gaulish village. The warriors of Gaul, Asterix and Obelix, are very good at counterattack, and can be stopped only if the catapults are all in line towards the Gaulish village (towards North). Also, the catapults are so heavy that he needs many men and horses to move one, and he can move only one catapult at a time. Also he knows that the counterattack is coming soon, and he needs to align them quickly. For simplicity, we model the situation as a n x n grid of squares with the initial position of the n catapults given. We need to advise Caesar on the minimum number of moves to align them in a vertical (northward) direction. A catapult can move North-South (up-down) or East West (left-right) but not diagonally.

29th Jul 2017, 6:28 AM
aditya
aditya - avatar
1 Resposta
+ 1
I think I might try
30th Jul 2017, 11:00 PM
Conquest Onyekachi Idam
Conquest Onyekachi Idam - avatar