← All problemsSign in

Knowledge is Fun

Naresh loves to read books a lot. One day he decided to read a book which contains $N$ pages. Out of the $N$ pages, each page contributes a different amout to his knowledge, that is, the $i$th page contributes $Xi$ knowledge. He has to select 5 pages among them such that he gains maximum knowledge. The knowledge gained is calculated as followes: $K = A*Xm – B*Xl + C*Xk – D*Xj + E*Xi$ such that

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start