Problem #17 of the book: THE MAN WHO COUNTED (Sample Programs)
Thanks for reading!
The book, stories of the Middle Ages Arabic.
The few problems apparently are simple and the solution proposed by the protagonist is very ingenious.
It is entertaining and fun book!
The interesting thing about the program, read the book and their stories.
Thank you for your opinion Jim!