Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Consider the problem faced by a group of marshals who are trying to cross as small
wooden bride. The bridge is very narrow and it is impossible for two people to stand side byside. Marshals from the blue unit and red unit are on either sides of the bridge. In spite ofseeing each other they continue to march towards each other and stop only when there is placeexactly for one person in between. At this point they realize that it is way too risky for themto turn back. A marshal can climb over another provided there is a vacant space.

(a) Let r denote the number of red marshals and let b denote the number of blue marshals.
For what all values of b and r is it possible for the marshals to cross over? Why?
(b) Write a computer program to simulate the bridge crossing. Your program should take in
as input two numbers r and b. If it is possible for the marshals to cross over, then your
program should show how the cross over can be achieved.
Posted
Updated 24-Aug-11 2:32am
v2
Comments
Richard MacCutchan 24-Aug-11 8:48am    
Very interesting, now get on and solve it.
hakz.code 24-Aug-11 10:00am    
:)

I look forward to John Simmons' "We don't do homework for people"-link
 
Share this answer
 
For what all values of b and r is it possible for the marshals to cross over?
r = 0;
b = 0;

Why?
Theyre sitting at home making homework.
;)
 
Share this answer
 
Comments
Richard MacCutchan 24-Aug-11 11:14am    
+5 for amusement value!
mbue 24-Aug-11 11:31am    
Its a pleasure for me. ;)
Tell your tutor that this problem is trivially solved using CORBA’s marshalling mechanism. If he/she doesn’t know what CORBA is, tell him/her it is a computerised serpent.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900