Small doubt in topcoder problem

dynamic-programming

#1

I am trying to solve this problem on Tocoder.In the problem they are given three colors red,green,black and the question is to find the postion with the best winning probability.
My doubt is that in order to find the best postion we need to check every configuration,Suppose if r=2,g=2,b=2 then there are (2+2+2)!/2!*2!*2! permutations.But in editorial they are using just three loops.
Any help will be highly appreciated.