Trains

When a train travels from one station to another, stopping at all stations in between is too time-consuming. The Japanese tackled this issue with a simple idea: skip some of the stations!

The FUTSŪ train stops at every station.
The KAISOKU train skips some stations.
The KYŪKŌ train skips more stations.
The TOKKYŪ train skips most stations, only stopping at the biggest stations.

Consider a hypothetical map below:

Alice is currently at the 1 st 1^\text{st} station and would like to travel with the fewest stops possible. She came up with a simple method:

Take the fastest train to the nearest station without passing the desired station. Repeat this procedure until reaching the desired station.

However, this algorithm does not always give the fewest stops. Which station can be traveled with fewer stops than the proposed algorithm requires?


For example, this is how Alice would travel to the 6 th 6^\text{th} station:

  • Take KYŪKŌ train from the 1 st 1^\text{st} station to the 5 th 5^\text{th} station.
  • Take FUTSŪ train from the 5 th 5^\text{th} station to the 6 th 6^\text{th} station.
4 5 8 9

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Roger Erisman
Apr 19, 2017

Algorithm would take Kyuko from 1st to 5th. Next take Kaisoko from 5th to 7th. Lastly, take Futsu from 7th to 8th. 3 stops.

Instead, take Tokkyu to 9th. Then take Futsu back to 8th. 2 stops.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...