VisaOA #10
Get Max Sum after K Operations
估计中等评测数据准备中,可先阅读题面
Given an integer n and an integer array arr[n]. Choose at most k operations. Each operation picks an index i and does arr[i] = arr[i] · arr[i+1]. Maximize the sum of all elements after performing operations.
Example: arr = [2, 3, 4], k = 1 → either keep sum 9, or replace arr[0] with 2*3 = 6 (sum 13), or replace arr[1] with 3*4 = 12 (sum 18). Answer 18.