Split the balls
CodeChefOpen on judge ↗
Chef has been given a special kind of ball. Size of the ball at any given time is indicated by an integer, n. Also, a ball of size n can be split into two balls of size n1 and n2 if n=n1+n2. This is done until neither n1 nor n2 can be written as product of legal values of n1 and n2. It is said that balls of size 1 do not exist. Given chef starts with two balls of size a and b, he can split eithe
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