Cheryl's birthday: Difference between revisions

From Rosetta Code
Content added Content deleted
(Find the birthday of Cheryl!)
 
No edit summary
Line 1: Line 1:
Albert and Bernard just became friends with Cheryl, and they want to know when her birthday is.
Albert and Bernard just became friends with Cheryl, and they want to know when her birthday is.

Cheryl gave them a list of 10 possible dates:
Cheryl gave them a list of 10 possible dates:


May 15 May 16 May 19
May 15, May 16, May 19
June 17 June 18
June 17, June 18
July 14 July 16
July 14, July 16
August 14 August 15 August 17
August 14, August 15, August 17


Cheryl then tells Albert and Bernard separately the month and the day of the birthday respectively.
Cheryl then tells Albert and Bernard separately the month and the day of the birthday respectively.

1) Albert: I don't know when Cheryl's birthday is, but I know that Bernard does not know too.
1) Albert: I don't know when Cheryl's birthday is, but I know that Bernard does not know too.

2) Bernard: At first I don't know when Cheryl's birthday is, but I know now.
2) Bernard: At first I don't know when Cheryl's birthday is, but I know now.

3) Albert: Then I also know when Cheryl's birthday is.
3) Albert: Then I also know when Cheryl's birthday is.

So when is Cheryl's birthday?
So when is Cheryl's birthday?

Revision as of 07:46, 22 October 2018

Albert and Bernard just became friends with Cheryl, and they want to know when her birthday is.

Cheryl gave them a list of 10 possible dates:

May 15, May 16, May 19 June 17, June 18 July 14, July 16 August 14, August 15, August 17

Cheryl then tells Albert and Bernard separately the month and the day of the birthday respectively.

1) Albert: I don't know when Cheryl's birthday is, but I know that Bernard does not know too.

2) Bernard: At first I don't know when Cheryl's birthday is, but I know now.

3) Albert: Then I also know when Cheryl's birthday is.

So when is Cheryl's birthday?