Krishna candies and box

Added: 2026-03-26 04:13:42

Question Image

Krishna candies and box

Answer

✏️ Edit
t = int(input())
for _ in range(t):
    n = int(input())
    l = list(map(int, input().split()))
    m = [l[0]]
    for i in range(1, n):
        m.append(m[-1] + l[i])
    print(sum(m[1:]))