2733-小鑫の日常系列故事(二)——石头剪子布-JAVA
小鑫の日常系列故事(二)——石头剪子布
Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description
小鑫在上幼儿园的时候,喜欢跟小伙伴健健玩石头剪子布的游戏 ,你能帮他们判断谁胜谁负么?
Input
输入有两行,每一行都有可能为“Rock”(石头),“Scissors”(剪子),”Cloth”(布)。第一行为小鑫的选择,第二行为健健的选择。
Output
输出有一行,如果小鑫赢了输出“Win”,输了输出“Lose”,平局输出“Equal”。(输出不包括引号)
Sample Input
Rock Scissors
Sample Output
Win
Hint
Source
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String mora1 = scanner.nextLine();
String mora2 = scanner.nextLine();
if (mora1.equals(mora2)) {
System.out.println("Equal");
} else {
if (mora1.equals("Cloth")) {
if (mora2.equals("Rock")) {
System.out.println("Win");
} else if (mora2.equals("Scissors")) {
System.out.println("Lose");
}
} else if (mora1.equals("Rock")) {
if (mora2.equals("Scissors")) {
System.out.println("Win");
} else if (mora2.equals("Cloth")) {
System.out.println("Lose");
}
} else if (mora1.equals("Scissors")) {
if (mora2.equals("Cloth")) {
System.out.println("Win");
} else if (mora2.equals("Rock")) {
System.out.println("Lose");
}
}
}
}
}