CCS Bot
CodeChefOpen on judge ↗
You have two arrays of integers, V = {V1, V2, …,VN} and P ={P1, P2,...,PN}, where both have $N$ number of elements. Consider the following function: score = 0 int Go(step, energy) { if (step == N) { score += V[step]; return (score); } else { int way = random(1, 2); if (way == 1) { score += V[step]; } else { energy = P[step]; } if (energy > 0) { Go(step + 1, energy - 1); } else { KillTheWorld();
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