题解 | 配置文件恢复

配置文件恢复

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

# 抄了评论区比较稳的代码记一下
import sys

for line in sys.stdin:
    s = line.split()
    if s[0] in "reset" and len(s)==1:
        print("reset what")
    elif len(s)==2:
        if s[0] in 're' and s[1]=='b':
            print("unknown command")
        elif s[0]=='b' and s[1]=='a':
            print("unknown command")
        elif s[0] in "reset" and s[1] in "board":
            print("board fault")
        elif s[0] in "board" and s[1] in "add":
            print("where to add")
        elif s[0] in "board" and s[1] in "delete":
            print("no board at all")
        elif s[0] in "reboot" and s[1] in "backplane":
            print("impossible")
        elif s[0] in "backplane" and s[1] in "abort":
            print("install first")
        else:
            print("unknown command")
    else:
        print("unknown command")






全部评论

相关推荐

牛客52811839...:有的hr就是这样啊,很正常。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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