包含多组测试数据时就需要使用while True
while True:
try:
n = int(input())
if n == 0:
break
nums = list(map(int, input().split()))
total = sum(nums)
average = total // n
result = 0
for i in range(n):
if nums[i] < average:
result += average - nums[i]
print(result)
print()
except:
break
//才是整除