This is one of H. E. Dudeney’s train puzzles.
“Two railway trains, one four hundred feet long and the other two hundred feet long, ran on parallel rails. It was found that when they went in opposite directions they passed each other in five seconds, but when they ran in the same direction the faster train would pass the other in fifteen seconds. A curious passenger worked out from these facts the rate per hour at which each train ran. Can the reader discover the correct answer? Of course, each train ran with a uniform velocity.”
See Two Trains – Passing in the Night for a solution.

The following is a famous problem of Bachet as recounted by Heinrich Dörrie in his book 100 Great Problems of Elementary Mathematics:
This is a great puzzle by H. E. Dudeney involving a very useful technique.
This is another puzzle from the
Years ago (1967) I read about an interesting solution to the three jugs problem in a book by Nathan Court which involved the idea of a billiard ball traversing a skew billiard table with distributions of the water between the jugs listed along the edges of the table. The ball bounced between solutions until it ended on the desired value. I thought it was very clever, but I really did not understand why it worked. Later I figured out an explanation, which I present here. See the