In the first step, there are C42=6 ways to choose two people to take Course A..
The second step is to arrange for the remaining two people to choose 1 from B and C, so there are two choices, 6*2*2=24 choices.
There is no formula for high school math problems, so students can rest assured. There is only one solution to this problem.