Cups and Balls
CodeChefOpen on judge ↗
Ram is playing a game where there are exactly N cups numbered 1 to N in a row in front of him and he has balls numbered from 1 to N with him. In this game his opponent gives him a number K(0 If the balls arranged in the row are numbered a1, a2, a3, .... an then a cup is good if |ai - i| = 1. Ram is a mathematician so, he is thinking the total number of ways he can arrange the balls in the cups su
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start