题解 | #输入n个整数,输出其中最小的k个#
输入n个整数,输出其中最小的k个
http://www.nowcoder.com/practice/69ef2267aafd4d52b250a272fd27052c
思路
输入输出格式。。
代码
while True:
try:
# split()分割所有空白字符❗️
n, k = input().split()
n_list = input()
x = [int(i) for i in n_list.split()]
x = sorted(x)
x = x[:int(k)]
# 要用map转到str。。❗️
print(' '.join(map(str, x)))
except:
break 
