QOD #30

"Please, Sir, can I have a glass of water," Le, standing there, tired from sweeping, said to Gary.

Unfortunately for Le, Gary was in a very sadistic mood.

"Oh, you can have your WATER. But it will cost you Heh HA HA Ha Ha..."

"Wait," said Le, "are you in a sadistic mood?"

"Yes," said Gary.

"Oh Great..."

"Anything else?" said Gary.

"No, that's it, go on," said Le.

"OK," said Gary, and he continued, "...HA HA HA HA HA! The price you will pay is a price in MATH. I have just refilled our 120 quart water cooler and here is a 7 quart jug and a 5 quart jug. You can have your precious water, but only if you can measure out exactly 1 quart without pouring any water back into the cooler (which is impossible anyway)."

"Can I get Stas to write a program for me to do it?"

"No!!!!" Gary was really enjoying this. "You must do it yourself, using only the two jugs."

"Ok," said Le, and she cleverly did it....and did it in a way which made Gary even madder thereby giving Le double the satisfaction.

Can you figure out how?

Solution and comments

Previous QODNext QOD
Index