112. On the Top Floor of a Castle Lives a Princess.
On the top floor of a castle lives a princess. The floor has 17 bedrooms arranged in a row. Each bedroom has doors connecting to the adjoining bedrooms as well as to the outside corridor. The princess sleeps in a different bedroom each night by opening the door to an adjoining bedroom and spending the night and the next day in that room.
One day a prince arrives at the castle and is desirous of marrying the princess. The guardian angel at the castle tells him of the princess sleeping patterns and informs him that each morning he may knock on one of the outside doors. If the princess happens to be behind that door, she will open it and consent to marry him. The prince also has a return ticket to his kingdom in 30 days; so he can make at most 30 attempts. Can the prince win the hand of the princess and if so, what is his strategy?
Submitted by tartle · Added 17 January 2013
Solution:
The prince should knock on door 9 every day. This strategy ensures that he will eventually find the princess regardless of her movement pattern, as she can only move to adjoining rooms. By starting at the middle door, he maximizes the chances of encountering her within the 30 days.
Comments (14)
He should just goto the same door, in the middle of the hallway every day.
_ = door
+= prince
_ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _
Even if she's 1 door after him on the first day he chose that door, he would always "find" her, regardless of it she "turned around" at the end of the hallway, or walked back to the "start"
At least, I'm pretty sure.
he should wait in the hallway. if the rooms are in a row there is a beginning and an end. so he is bound to see her and ask for her hand.
he mines the walls :lol:
he mines the walls :lol:
The Prince would knock on door 9 every day. No matter where the princess was, it would take a maximum of 9 days for her to make it back to him. (Assuming that when she arrived at the end she would cycle back- and not use the hallway).
Shout "FIRE!" and wait for her to run out...
On the top floor of a castle lives a princess. The floor has 17 bedrooms arranged in a row. Each bedroom has doors connecting to the adjoining bedrooms as well as to the outside corridor. The princess sleeps in a different bedroom each night by opening the door to an adjoining bedroom and spending the night and the next day in that room.
The prince could knock on any one of the doors day after day waiting for the princess, but the problem says she moves to an adjoining room at night. This means the princess may very well move between rooms 16 and 17 exclusively.
This may just be me, but whenever I head over to my friends place, I tend to knock on the front door of his house to get his attention, not his bedroom door.
i think the prince should wait at the first door because as he have 30 chances the princess will surely come in the first room as there are only 17 room available if she is in the 3 room also at the arrrival of the prince she will return to the 1 room within 30 days :roll: 8) :lol:
I 'ld suggest him to marry guardian angel.... :lol:
Because the princess could alternate only between door 16 and 17, he should not knock on the same door every time and wait for her to pass him.
He should knock twice on door 2 then twice on door 3 then 4 and 5 and so on until door 16.
If the princess were moving across the rooms from 8 to 7 to 6, he would intercept her as he moves across. If she is alternating only in 1 and 2 she could spend the first night in 1 and he would knock on 2, but the next night she would have to move to 2 and he would knock there again, this would be the same for doors 16 and 17.
he only has to knock on one door,there are only 17 door's.
:o
to alt_16064
Knocking twice on door 2 then twice on door 3 then 4 and 5 and so on until door 16 won't work.
That strategy is defeated if the princess begins in room 4 and moves 4-3-2. On the third day she's in room 2 when he's knocking on room 3. He would then need to double back to catch her if she continued 1-2-1-2 so 2-2-3-3 etc. won't work.
The princess can never be in an adjacent room when the prince knocks a second time because she can skip over him on the next move if he knocks on her previous room
I'm not sure if there is a solution in 30 knocks. I certainly don't consider this a "very easy logic problem" unless I'm missing something.
Its a very refined question and is "Not very easy"
Strategy begins from the point:
let the rooms be A,B,C,... from one end of corri to other.
Its a very good game of Trapping and position.
For eg. if I knock at room F on day 1
and if princess is in E or G,
she may move to D or F if in E,
she may move to H or F, if in G,
next I should knock on room D, then next on I (she could not have escaped had the hypothesis been true, and recursively reduce the length of rooms in which she may move.)
I do not think finding an algorithm will be easy.
The Prince should knock on the second door from one of the ends of the corridor (call it door #2), and knock on the next adjacent door each successive day until he reaches the second door from the opposite end of the corridor (door #16). The day after that, he should begin the same process in reverse order (meaning he will knock on the 16th door two days in a row). By the time he reaches his starting point (door #2 on the 30th day), he will have found the princess.
Number the doors 1 thru 17.
If the princess occupies an even numbered room on the day the prince first knocks on a door (#2), then she will either occupy the same room he knocks on or she will be an even number of rooms away. Since both move to an adjacent room each day, this will hold true so she will never be in a room adjacent to the one he knocks on, and thus never be in a position to move past him the next day. She will have nowhere else to go by the time he reaches the 16th door, and will have by then been located. If she, on the other hand, was in an odd numbered room when he began, then she will be in an even numbered room when the prince starts the process again on day 16 (when he knocks on door #16 the second time).
Add a Comment or Suggest an Answer