← RoseCode

ROSECODE 192

Trains

Philippe_57721 · Programming ·

On a circular track, three trains travel at the same speed: one unit per second.

The track has a length of 641 units.

  • Train n° 1 has a length of 11 units and occupies the position 0 to 10. It travels clockwise
  • Train n° 2 has a length of 13 units and occupies the position 100 to 112. It travels counter-clockwise
  • Train n° 3 has a length of 17 units and occupies the position 200 to 216. It travels clockwise
When two trains collide, they collide elastically, and go in the opposite direction at the same speed.

The trains start to move at T=0.

At which T do the trains occupy the same position again?

[My timing: 5 sec]
Here is an example:
(Image credit: apgoucher. I will remove it if there is a copyright issue)