Four people are in a bar.
Ben owes Glen a drink. Glen owes Rhen two drinks. Rhen owes Sven three drinks. Sven owes Ben four drinks.
To settle up, what is the minimum number of drinks that need to be bought by who for whom?
(In reply to
ben glen rhen sven ... ten! by boom)
yeah, but that means Ben paid for one of the drinks he ends up getting.
Ben doesn't have to buy a drink ... If you have Sven buy the first drink.
Rationale:
Start:
< Ben owes 1, Glen 2, Rhen 3, Sven 4 >
< Ben owed 4, Glen 1, Rhen 2, Sven 3 >
Drink 1: Sven buys Ben a drink. Ben gives it to Glen, who gives it to Rhen, who gives it to Sven. They've all "paid off" 1 drink. Then, Sven gives it to Ben again, so Sven's paid off 2.
< Ben owes 0, Glen 1, Rhen 2, Sven 2 >
< Ben owed 2, Glen 0, Rhen 1, Sven 2 >
Drink 2: Glen buys one for Rhen, who gives it to Sven, who gives it to Ben.
< Ben owes 0, Glen 0, Rhen 1, Sven 1 >
< Ben owed 1, Glen 0, Rhen 0, Sven 1 >
Drink 3: Rhen buys one for Sven, who gives it to Ben.
< Ben owes 0, Glen 0, Rhen 0, Sven 0 >
|
Posted by sach
on 2002-12-18 14:39:21 |