#23406: python answer


sean2008 (李松錡)

學校 : 臺北市私立復興實驗高級中學
編號 : 124356
來源 : [111.241.175.105]
最後登入時間 :
2023-09-29 14:24:42
c067. 00591 - Box of Bricks -- UVa591 | From: [118.160.83.235] | 發表日期 : 2020-11-14 10:55

count = 0
while True:
    x = int(input())
    if x == 0:
        break
    y = list(map(int, input().split()))
    avg = int(sum(y)/x)
    a = 0
    for i in y:
        a += abs(i-avg)
    count += 1
    print('Set #' + str(count))
    print('The minimum number of moves is', str(a//2) + '.')
    print()
 
ZeroJudge Forum