题解 | 斗兽棋,这题也没啥,就是需要注意一下斗兽棋平局不一定是一样,也有可能是越级吃不了

斗兽棋

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

#include <iostream>
using namespace std;

int main() {
    string s1,s2;
    cin>>s1>>s2;
    if (s2=="elephant"&&s1=="tiger"||s2=="tiger"&&s1=="cat"||s2=="cat"&&s1=="mouse"||s2=="mouse"&&s1=="elephant") {
        cout<<"lose"<<endl;
    }
    else if (s1=="elephant"&&s2=="tiger"||s1=="tiger"&&s2=="cat"||s1=="cat"&&s2=="mouse"||s1=="mouse"&&s2=="elephant") {
        cout<<"win"<<endl;
    }
    else {
        cout<<"tie"<<endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

评论
6
收藏
分享

创作者周榜

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