Remove A and B, line up the remaining n-2 people, and then insert A and B into the line.
There are two steps to accomplish this: queuing and inserting, so the arrangement method is (n-2)! ×2(n-r- 1),
The probability is (n-2)! ×2(n-r- 1)/n! =2(n-r- 1)/n(n- 1)
Note: Insert A and B into the team. As long as one person is inserted, the position of the other person is fixed.
N-2 people line up, * * with n-2+ 1=n- 1. According to the requirements, there should be exactly R people between A and B, so you might as well insert an A first, and then
A comes before B, and there are at least R people behind A, so A has (n-r- 1) spaces. Considering the rotation of A and B, the arrangement is 2(n-r- 1).