• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I have a logical question one.. can any one tell the logic.......

#1
[eluser]Unknown[/eluser]
Question 1
A neighborhood had been raided by Indian Army in search of Terrorist. They land on different buildings from a helicopter.
The roof tops of these buildings are connected to each other through a ladder.
Each soldier can control the buildings in straight lines (left-right and forward-backward) with respect to the building/position they have been dropped on.
They cannot control the diagonal buildings. There are 8 buildings in each row and column.

Input
Your program must read two arguments i.e. soldierCount and soldierPositions where
SoldierCount is the number of soldiers landed
and
SoldierPositions is an array of x and y coordinate positions of the soldiers {x,y} where x represents row and y represents column starting from {1,1}

Output
Your function GetBuildingCount should compute the total number of buildings controlled by soldiers and write it to 'output1' variable.

e.g. output1 for the above example should be 22.

Examples
When two soldiers are dropped at positions 5,5 and 5,3 respectively, then inputs to the function would be as follows

soldierCount = 2
soldierPositions = {{5,5}, {5,3}}

If you wish to specify inputs to your program - separate it by a Colon(Smile
E.g. The above inputs should be specified as 2:{{5,5},{5,3}}

Output:
output1 for the above example should be 22.


Messages In This Thread
I have a logical question one.. can any one tell the logic....... - by El Forum - 07-13-2012, 04:48 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.