题解 | 斗兽棋

斗兽棋

https://www.nowcoder.com/practice/0b5afb815f6848d9a7f9c1b0ce514b95

import sys



s1,s2 = map(str,input().split())
eat ={"elephant":3,"tiger":2,"cat":1,"mouse":0}
#当差值为1时,或者差值为-3 为赢
if eat[s1]-eat[s2]==1 or eat[s1]-eat[s2]==-3:
    print("win")
#差值为-1 或者差值为3 为输
elif eat[s1]-eat[s2]==-1 or eat[s1]-eat[s2]==3:
    print("lose")
#其他都为平局
else:
    print("tie")    

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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