题解 | 神秘石像的镜像序列

神秘石像的镜像序列

https://www.nowcoder.com/practice/fa34eea974234610b6d3d81790cb2949

input_str = input()
# 分割字符串得到数字列表
numbers = input_str.split()

# 移除列表中的所有 '0'
numbers = [x for x in numbers if x != '0']

# 转换为整数列表
numbers = list(map(int, numbers))

# 反转列表并打印
print(' '.join(map(str, numbers[::-1])))

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务