File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programming Diversions and the fly likes A simple  puzzle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "A simple  puzzle" Watch "A simple  puzzle" New topic

A simple puzzle

Lizette Donelly

Joined: Nov 19, 2003
Posts: 7
A king has 9 soldiers on each side of his castle, doing guard duty.
@@@ @@@ @@@

@@@ castle @@@
@@@ @@@ @@@
Part 1:
War breaks out, and he needs 4 of these men to go fight. He still wants 9 men guarding him on each side, with men in the centre and sides positions as originally. How does he do it with the remaining men?
Part 2:
They win the war, and the 4 men came back to guard duty. But for safety reasons he wants an additional 4 men guarding him. He still wants only 9 on each side etc. etc. (as part 1), but with the four additional men added to the original amount of men. How does he organize the men?
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

Unfortunately HTML is disabled in this forum, so I can't hide my answer in the same color font as the background.... SO... if you don't wanna see my solution, don't scroll down!!!
ok -- here it is:
9 on each side, 20 men total

9 on each side, 28 men total:

[ November 20, 2003: Message edited by: Jessica Sant ]

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
I agree. Here's the link:
subject: A simple puzzle
It's not a secret anymore!