1. 程式人生 > >2733-小鑫の日常系列故事(二)——石頭剪子布-JAVA

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");
				}
			}
		}
	}
}