#40432: python


RatTailLiquid (RatTailLiquid)

學校 : 國立臺灣師範大學附屬高級中學
編號 : 252146
來源 : [111.241.151.252]
最後登入時間 :
2024-10-20 23:21:29
c067. 00591 - Box of Bricks -- UVa591 | From: [111.241.142.182] | 發表日期 : 2024-05-19 10:37

t = 0
while 1:
  n = int(input())
  m = 0
  t+=1
  if n == 0:
    break
  def same(li):
    return len(set(li)) == 1
  a = [int(x) for x in input().split()]
  print(f"Set #{t}")
  avg = sum(a)/n
  if same(a) == False:
    for k in a:
      if k<avg:
        m+=avg-k
  print(f"The minimum number of moves is {int(m)}.")
 
ZeroJudge Forum