1. Chalenge
- Posted by engale2000 at hotmail.com Dec 14, 2001
- 455 views
Three sailors were shipwrecked on a deserted island. The only life they could observe on the island were birds and a monkey, and the only food source seemed to be coconuts from the coconut trees. They agreed to pool their efforts to gather the coconuts for food into one area and divide the coconuts equally. After gathering the coconuts, the sailors were too tired to eat and decided to sleep for the night and divide the pile of coconuts in the morning. During the night one of the sailors awoke, divided the pile of coconuts into three equal piles, but had one coconut left over which he gave to the monkey watching him in puzzlement. Then he hid one pile, put the other two piles back together, and went back to sleep. A little later the second sailor awoke and did the same thing, making three equal piles of coconuts and had one coconut left over which he gave to the monkey, hiding his pile, returning to sleep. The third sailor awoke and did exactly the same thing (he also had one coconut left over which he gave the monkey, etc.). In the morning non of the sailors would admit that the pile of coconuts looked smaller for fear of incriminating themselves, and so they divided the remaining coconuts equally into three piles, and had one left over which they gave to the monkey. What is the smallest number of coconuts that could have been in the original pile before any divisions were made? For this program use only while loops and wPuts it out in a exw file for win32.
2. Re: Chalenge
- Posted by Euman <euman at bellsouth.net> Dec 14, 2001
- 436 views
> What is the smallest number of coconuts that could have been in the original > pile before any divisions were made? The answer is 256 coconuts 3 / 256 = 85.3333333 3 / 64 = 21.3333333 3 / 16 = 5.3333333 3 / 4 = 1.3333333 Monkey had four as for the Win32 program, why dont you give it a shot and see what you come up with... along the way, we here on the list will give you some tips... How bout that? Euman euman at bellsouth.net
3. Re: Chalenge
- Posted by jzeitlin at cyburban.com Dec 15, 2001
- 436 views
On Fri, 14 Dec 2001 23:19:44 -0800, Euman <euman at bellsouth.net> wrote: >Subject: Re: Chalenge >> What is the smallest number of coconuts that could have been in the original >> pile before any divisions were made? >The answer is 256 coconuts Nope, it's 79. I can explain how I arrived at that (I did it by hand, but once I did, the algorithm to use was obvious), but it would give away too much. When the challenge closes, I'll be happy to explain. -- Jeff Zeitlin jzeitlin at cyburban.com (ILink: news without the abuse. Ask via email.)
4. Re: Chalenge
- Posted by jzeitlin at cyburban.com Dec 15, 2001
- 447 views
On Sat, 15 Dec 2001 11:36:22 -0800, engale2000 at hotmail.com wrote: >----------------------------- >Sorry for not saying this to begin with but all of the coconuts are >whole. There are no broken(decimal, doubles) in this one. Assumed in the solution I arrived at. -- Jeff Zeitlin jzeitlin at cyburban.com (ILink: news without the abuse. Ask via email.)
5. Re: Chalenge
- Posted by Rolf Schröder <r.schr at t-online.de> Dec 16, 2001
- 429 views
Alvin Koffman wrote: > > > ok thanks. > Alvin > --- Evan Marshall <evan at net-link.net> wrote: > > > > if (floor(var) = var) then > > If var <= 2^30 then you could use: if integer(var) then Have a nive day, Rolf