在一行输入两个以空格分隔的字符串 ,其中 ,分别代表牛牛和牛妹所出的棋子。
如果牛牛获胜,输出 ;如果牛妹获胜,输出 ;如果平局,输出 。
tiger elephant
lose
牛牛出 `tiger`,牛妹出 `elephant`;大象吃老虎,牛牛落败,因此输出 `lose`。
d = {'mouse': 0, 'cat': 1, 'tiger': 2, 'elephant': 3} n, m = input().split() ret = d[n] - d[m] if ret == 1&nbs***bsp;ret == -3: print('win') elif ret == -1&nbs***bsp;ret == 3: print('lose') else: print('tie')
rules = { "elephant":"tiger", "tiger":"cat", "cat":"mouse", "mouse":"elephant" } s1,s2 = map(str,input().strip().split()) if rules[s1] == s2: print("win") elif rules[s2] == s1: print("lose") else: print("tie")
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题