Rachel and Ross are about to eat pizzas. Apparently, both of them are hungry and have a huge appetite. So Ross brings 5 pizzas while Rachel brings 3 pizzas. Each pizza has six slices in total. They’re about to sit together and eat when suddenly Joey turns up. Joey agrees to give them money in return for food. So the three of them divide the 8 pizzas(i.e. 48 slices) equally and eat it. Joey has $8 in cash.
Being weak in maths he decides to pay Rachel and Ross equally i.e. $4 each. Ross vehemently objects to it. Help Joey divide the 8$ amongst the two of them fairly. (They did not mix the pizza with each other )
The intuitive answer to this problem is that they should be paid in the proportion to what they put in. However, the answer to this puzzle isn’t $3 and $5.
The most important thing to note in this puzzle is that Ross and Rachel consume a part of what they put in. The key to the puzzle is that Ross and Rachel do not give all their pizzas to Joey: they eat 8/3 pizzas (i.e 48 / 3 = 16 slices) of the pizzas themselves each.
There are three people eating 8 pizzas, with each person getting an equal share. This means each person eats 8/3 of the pizzas. So let’s see what each person contributes. Joey pays $8.
Ross eats a total of 8/3 pizzas (16 slices).
He brought a total of 5 pizzas (5 * 6 = 30 slices)
Hence, his net contribution becomes: 5 – (8 / 3) = 7 / 3 pizzas(14 slices).
Rachel eats a total of 8/3 pizzas too(16 slices).
She brought a total of 3 Pizzas. Therefore, she only gives up 1/3 pizzas (i.e. 2 slices)
Hence, her net contribution becomes: 3 – (8 / 3) = 1/3 pizzas (2 slices).
Ross gives up seven times more slices than Rachel. Therefore , they should be paid in proportion of their net contribution i.e. in a ratio of 7 / 3 : 1 / 3 which is 7 : 1. Given the ratio of resources each gave to Joey, the fairest solution is for Rachel to get one dollar and Ross to get seven dollars.
Hence, Ross gets a total of 7$ while Rachel gets only 1$
This article is contributed by Ankit Jain . If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.