Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
17990 | kids | 石子 | Python3 | Compile Error | 0 MS | 0 KB | 235 | 2023-05-20 16:12:09 |
n = int(input()) ls = [int(i) for i in input().split()] avg = sum(ls) // n for i in range(n): if i == 0: ls[i] -= avg else: ls[i] -= avg ls[i] += ls[i-1] ls.sort() tot = 0 for x in ls: tot += abs(x - ls[n // 2]) print(tot)