Coin Game
CodeChefOpen on judge ↗
There are $n$ piles of coins, where the $i$th pile has $a_i$ coins. You need to collect the maximum number of coins from these piles, but you must fulfill the following condition: Let's say you pick $x_i$ coins from the $i$th pile, then: - $x$1+$x$3+$x$5... = $x$2+$x$4+$x$6 - $0 \leq x_i \leq a_i $ For example, if $n$=3 and, $a$=[2,3,2], you can pick the coins as $x$= [1,2,1] becuase $x$1
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