Minimum Sum
You are given an array $A_1, A_2, \dots, A_N$ of length $N$. You can perform the following operation any number of times (possibly 0 times) : - Choose any two indices $i$ and $j$ and replace either $A_i$ or $A_j$ with $\gcd(A_i,A_j)$. Find the minimum possible sum (ie. $A_1 + A_2 + \dots + A_N$) that you can achieve, and output that. ### Input - The first line of input will contain a single inte
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