题解 | #输入n个整数,输出其中最小的k个#
输入n个整数,输出其中最小的k个
http://www.nowcoder.com/practice/69ef2267aafd4d52b250a272fd27052c
while True:
try:
num = input().split()
num_1 = int(num[0])
num_2 = int(num[1])
a = input().split()
b = []
for i in a:
b.append(int(i))
b = sorted(b) #排序
for i in range(num_2):
print(b[i],end = ' ') #按格式输出
print('\r')
except:
break
华为机试题解(prod.by kedao) 文章被收录于专栏
华为实习机试题解