koseke @ 2024-10-30 12:30:04
lst = input().split()
ord = input()
lst.sort()
rst = ''
for x in ord:
if x == 'A':
rst += lst[0] + ' '
elif x == 'B':
rst += lst[1] + ' '
elif x == 'C':
rst += lst[2] + ' '
rst = rst.rstrip()
print(rst)
by xywuyu @ 2024-10-30 12:38:40
100 5 3 CBA
by xywuyu @ 2024-10-30 12:38:57
@koseke 自测一下
by koseke @ 2024-10-30 12:46:35
@xywuyu 感谢感谢,我没有注意到字符串列表排序和整数列表排序的区别
by Estrella_Explore @ 2024-10-30 12:53:24
已 AC:
a = input().split()
order = input()
nums = []
for x in a:
nums.append(int(x))
nums.sort()
for x in order:
if x == 'A':
print(nums[0], end = ' ', flush = 0)
elif x == 'B':
print(nums[1], end = ' ', flush = 0)
elif x == 'C':
print(nums[2], end = ' ', flush = 0)