把每一項都加起來之後從第一項開始遍歷
eg:
1 2 3
sum = 6
開始遍歷
arr[0] = 1 * (6-1) = 5
arr[1] = 2 * (5-2) = 6
arr[2] = 3 * (3-3) = 0
ans = 5 + 6 + 0
幫忙補充一下,sum也要用unsighned long long喔