← All problemsSign in

Maximum Value

Consider the equation a1 + a2 + a3 +.....+ an = K consisting of $n$ terms. You are given the value of K . You will be also given a value of n, the number of terms in the equation, followed by n space-separated positive integers b1, b2, ....., bn. Your task is to calculate the maximum value of a1b1 * a2b2 * a3b3 ........ anbn. Since maximum value can be large, output the value modulo 109 + 7.

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