hmm... interesting logic, but what about, for example,   8 people and
3 hats.   Why can't one of the five without hats also be unsure and
try to go swimming on one of the nights?

I was thinking, if they somehow know how many hats there are (writing
numbers in the sand or other cheating methods), it would be "n choose
c" days at most, if they try a combination every night.   But this can
further be simplified to just "n" at most, if exactly one new person
goes by himself at night.

One cheating method:  one man is a leader.   The leader chooses all
men he sees with hats and says "let's go swimming at midnight".   If
that does not work, the next night the same people (but without the
leader) go swimming at midnight.   Two nights.

So... I'm thinking  n days, since the men do not know how many hats
there are.  And if cheating is allowed, 1-2 days.  Remember, the
question did say "the men cannot *tell* each other..."    =P



On Aug 18, 7:15 am, DheerajSharma <dheerajsharma1...@gmail.com> wrote:
> Case 1:
> when one person is wearing hat.The person wearing hat will see that no
> other is wearing hat.hence he must be wearing it.So she will take it
> off.hence one day
> Case 2:
> when two persons are wearing,first will think..that only second one is
> wearing..while second will think only first one is wearing.hence no
> one will go on first day.
> on the second day..when both will see the same thing..they will come
> to know..that they are also wearing hat..and making the second one
> confused ;)  hence..they both will go and take off hat on second day.
> Case 3:
> first person sees hat on two others.(same for other two). no one will
> go on first day.
> On second day..same situation..bt this time the person is still
> unsure..wether she is wearing hat or not..bcoz case 2 can happen..
> on third day..when same situation arises...they will come to
> know..that they are also wearing hat..hence..they will take it off on
> day 3.
> so on..
> so on..
> For C hats...C dayz...
>
> On Aug 18, 4:06 pm, DheerajSharma <dheerajsharma1...@gmail.com> wrote:
>
>
>
>
>
>
>
> > it would take c days to take off all the hats
>
> > On Aug 18, 3:51 pm, "pg@manit" <gpt.pa...@gmail.com> wrote:
>
> > > A bunch of men are on an island. A genie comes down and gathers
> > > everyone together and places a magical hat on some people’s heads
> > > (i.e., at least one person has a hat). The hat is magical: it can be
> > > seen by other people, but not by the wearer of the hat himself. To
> > > remove the hat, those (and only those who have a hat) must dunk
> > > themselves underwater at exactly midnight. If there are n people and c
> > > hats, how long does it take the men to remove the hats? The men cannot
> > > tell each other (in any way) that they have a hat.
> > > FOLLOW UP
> > > Prove that your solution is correct.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to