题解 | 斗兽棋

斗兽棋

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

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);


        String a = in.next();
        String b = in.next();
        //System.out.println(a.equals(""));
        if ((a.equals("elephant") && b.equals("tiger")) || (a.equals("tiger")  &&
                b.equals("cat") ) ||
                (a.equals("cat")  && b.equals("mouse") ) || (a.equals("mouse") &&
                        b.equals("elephant"))) {
            System.out.println("win");
        } else if ((b.equals("elephant") && a.equals("tiger")) || (b.equals("tiger")  &&
                a.equals("cat") ) ||
                (b.equals("cat")  && a.equals("mouse") ) || (b.equals("mouse") &&
                        a.equals("elephant"))) {
            System.out.println("lose");
        } else {
            System.out.println("tie");
        }



    }
}

史山

全部评论

相关推荐

03-11 16:05
运城学院 Java
程序员小白条:简历内容太多了,而且一段实习都没的情况下,写这么多,没啥说服力,反而让人觉得假
听劝,我这个简历该怎么改...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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