The answer is 7 times.
1. First, 25 horses were divided into 5 groups A, B, C, D, E to compete. The number of matches is 5 times. Get the first name of each group, numbered a1,b1,c1,d1,e1 respectively.
2. Then we will play the first place in each group and draw the result. Suppose A1>b1>c1>d1>e1. (The greater than sign indicates that A1 is faster than B1 and 1 is the first place). In this place we can infer that A1 is the fastest of all horses, so it is the first. D1,e1 could not be the first three horses, and the two horses in the same group could not be the first three horses. So the two groups of horses were excluded, and three groups of 15 horses were left. Now we need to find the second and third fastest horses.
3. The second and third horses had the following distribution in the competition:
All in Group A (the fastest horse in the group), then it has A1 and A3.
All in group B, then they are B1 and B2.
A horse in Group A is in Group B, then they are A2 and B1. Either the third place in Group A or the second is the two in Group A.
A horse in Group A in Group C, then they are A2 and C1.
One in Group B and one in Group C, then they are B1 and C1.
So we took the a2,a3,b1,b2,c1 out and played a game. Taking the first two is the final result.
Reference: http://coolshell.cn/articles/1202.html
"Algorithmic research" 25 horse races, only 5 horses at a time, the fastest race to find the fastest running 3 horses? The race cannot be timed, and the speed of each horse is assumed to be constant.