@[w18304159518](/user/1417367)
①插入代码请看编辑框上栏 `</>` 按钮。
②使用洛谷输入的裸字符串最好先 `.strip()` 一下,`顺序 = input("")` 改成 `顺序 = input("").strip()` 就过了。原因:[请注意洛谷题目数据可能含有 `\r`!!](https://www.luogu.com/paste/cb7doh5c)
③`input("")` 的括号里面的 `""` 不是必须写的,改成 `input()` 也可以。
④列表赋值、迭代器赋值直接逗号隔开连写即可:`a,b,c=表`。
我给你改完并简化了一下代码:
```python
a , b , c = sorted(map(int,input().split()))
顺序 = input().strip()
if 顺序 == "ABC":
print(f"{a} {b} {c}")
elif 顺序 == "ACB":
print(f"{a} {c} {b}")
elif 顺序 == "BAC":
print(f"{b} {a} {c}")
elif 顺序 == "BCA":
print(f"{b} {c} {a}")
elif 顺序 == "CAB":
print(f"{c} {a} {b}")
elif 顺序 == "CBA":
print(f"{c} {b} {a}")
```
其实这个最后判断的也可以再简化就是了。
by Terrible @ 2024-10-14 00:47:48
```python
a , b , c = sorted(map(int,input().split()))
顺序 = input().strip().lower()
exec(f"print({顺序[0]},{顺序[1]},{顺序[2]})")
```
by Terrible @ 2024-10-14 00:50:23
@[Terrible](/user/195942) 感谢大佬
by jsmbjsm @ 2024-10-14 10:04:35
@[Terrible](/user/195942) 感谢大佬
by w18304159518 @ 2024-10-14 12:11:05