Hacker News new | ask | show | jobs
by tzs 1675 days ago
That's not solvable as stated. I think you may have accidentally misstated the question.

> 100 ants are spaced evenly on a 1m stick

Are the ends at the end of the line of evenly spaced ants on the very ends of the stick?

> They travel at 1m/minute.

Is each ant initially traveling? What is the initial travel direction of each traveling ant?

This matters because if the ants are all traveling in initially traveling then (assuming maximal even initial spacing) it would take 1 minute for the last ant to fall off, but if each ant were initially traveling towards the nearest end it would take about 1/2 minute.

Googling, I found almost the same problem except that the question asked was what is the minimum time that guarantees all ants will have fallen off no matter what their initial directions are.

1 comments

Does it matter if they are evenly spaced? I think max time needed is the same if they are randomly spaced.
You are correct. Even spacing does not matter.

There are many initial configurations that achieve the maximum time before the last ant falls off the stick, and that includes configurations where they are evenly spaced and configurations where all but one ant is randomly spaced (achieving maximum time requires that at least one ant be in a particular initial state--I'm being vague to avoid spoilers).

(This is all assuming mathematical ants...point sized and can change direction instantly)