Ben and Stones
CodeChefOpen on judge ↗
Ben and his friend were bored and so they decided to play a little game. They had with them, N piles of stones. In this game the players take alternate turns and in each turn they can do either one of the following: - Remove all the stones from the largest pile. - Remove 1 stone from all the available piles. The player who can't make a move loses the game and Ben always starts first. Help Ben t
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