What is the logic of question Three is Crowd?

Plz someone help me with logic of question CROWD Problem - CodeChef. There are so many cases possible applying combination and i am not able to give it a generalised form .

@aayushi24:

have a look at the editorial : CROWD - Editorial - editorial - CodeChef Discuss

1 Like

thanks @squal