题解 | 斗兽棋
斗兽棋
https://www.nowcoder.com/practice/0b5afb815f6848d9a7f9c1b0ce514b95
#include <iostream>
using namespace std;
int main() {
string str1,str2;
cin>>str1>>str2;
if(str1=="elephant"&&str2=="tiger"||
str1=="tiger"&&str2=="cat"||
str1=="cat"&&str2=="mouse"||
str1=="mouse"&&str2=="elephant"){
cout<<"win";
return 0;
}
if(str2=="elephant"&&str1=="tiger"||
str2=="tiger"&&str1=="cat"||
str2=="cat"&&str1=="mouse"||
str2=="mouse"&&str1=="elephant"){
cout<<"lose";
return 0;
}
else{
cout<<"tie";
return 0;
}
}
// 64 位输出请用 printf("%lld")
查看23道真题和解析