def main n x = mapint inputsplit arr = listmapint inputsplit end = x - 1 minval = minarr arr = element - minval for element in arr cnt = minval n while arrend != 0 arrend
def main(): n, x = map(int, input().split()) arr = list(map(int, input().split()))
end = x - 1
minval = min(arr)
arr = [element - minval for element in arr]
cnt = minval * n
while arr[end] != 0:
arr[end] -= 1
cnt += 1
end -= 1
if end < 0:
end = n - 1
arr[end] = cnt
print(' '.join(list(map(str, arr))))
main()
原文地址: http://www.cveoy.top/t/topic/iRv4 著作权归作者所有。请勿转载和采集!