📜 ⬆️ ⬇️

From Peter to Anapa

Warning: this is a fairly simple task. She is well suited for an interview and will decide in her mind for 10 minutes.

So, not so long ago, I traveled by train from St. Petersburg to Anapa and back. The train left St. Petersburg at 5:00 pm, it was exactly 49 hours on the road and came to Anapa at 6:00 pm two days later. The return train left Anapa at 21:00, was also on the way 49 hours and came to St. Petersburg at 22:00 two days later.
On the way, I looked at the schedule and noticed that the trains leave St. Petersburg for Anapa and from Anapa for St. Petersburg every day of the week at 5 pm and 9 pm, respectively. I wondered: what is the minimum number of trains needed to keep to a schedule?

Note 1: trains are perfect (they always go from P to A and from A to P in 49 hours, they do not break, they can be reused immediately); trains always depart at 5:00 pm and 9:00 pm (passengers are not late, the engine driver does not leave for a binge)
')
Note 2: the correct answer to this problem is exactly the number of trains that RZD uses (I asked the conductor); Alas, remark 1 on Russian Railways does not apply :)

Source: https://habr.com/ru/post/22214/


All Articles