Face questions thinking, 25 horses five runways to take the first three, the minimum number of matches - eight

  See this road feeling very interesting algorithm problem, manually push down the feeling of the online answer is not quite perfect.

  First of all, the title assumptions such as the title, and the game does not record time, any number of race horses.

  solution:

  1, the horse race is divided into five groups, each group get ranking and record five times ----

  2, taking the top three of each group (a total of 15), each of the third begins the game, leaving only the first. 

  3, out of the second group with make up, the second step to continue the game, out of every four, a total of three times can be required to obtain the top three ( a total of 8 matches )

Decide the top five: you need to consider a special case, randomization, the separation of the group of death (the top five, there are four more than in the group), if after the last game, there are still groups of participants is the third and final game third in the top two, then sent four or five play-off time

Guess you like

Origin www.cnblogs.com/xueyudlut/p/11545112.html