You are viewing a single comment's thread. Return to all comments →
Python
n = int(input()) arr = list(map(int, input().split())) og_sum = sum(arr) total_sum = sum([(i+1) * arr[i] for i in range(n)]) max_sum = total_sum for i in range(1, n): total_sum += (n * arr[i-1]) - og_sum max_sum = max(max_sum, total_sum) print(max_sum)
Seems like cookies are disabled on this browser, please enable them to open this website
Game Of Rotation
You are viewing a single comment's thread. Return to all comments →
Python