結果

問題 No.264 じゃんけん
ユーザー yugi0922yugi0922
提出日時 2020-06-24 08:17:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,770 bytes
コンパイル時間 5,710 ms
コンパイル使用メモリ 74,388 KB
実行使用メモリ 56,404 KB
最終ジャッジ日時 2023-09-16 20:53:42
合計ジャッジ時間 6,975 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
55,696 KB
testcase_01 AC 111 ms
55,860 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 110 ms
56,052 KB
testcase_05 AC 112 ms
55,916 KB
testcase_06 AC 113 ms
56,012 KB
testcase_07 WA -
testcase_08 AC 109 ms
56,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import static java.lang.System.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class JanKen_03 {
	static final int[] myvalidValues =  {0,2};
	static final int[] yourvalidValues =  {0,2};
	static final int GU = 0;
	static final int TYOKI = 0;
	static final int PA = 0;
	//勝敗
	static final String KATI = "Won";
	static final String MAKE = "Lose";
	static final String AIKO = "Drew";
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		int myHand = 0;
		int yourHand = 0;
		try{
			String[] inputs = reader.readLine().split(" ");
			myHand = Integer.parseInt(inputs[0]);
			yourHand = Integer.parseInt(inputs[1]);
			if(validNum(myHand, yourHand, myvalidValues, yourvalidValues )){
				System.out.println(janKen(myHand, yourHand));
			}

		}catch(NumberFormatException ne){
			System.out.println("1~2の数字を入力してください");
		}catch(IOException io){
			System.out.println("読込中にエラーが起きました");
		}finally{
			try{
				reader.close();
			}catch(IOException io){
				System.out.println("BufferedReaderのクローズに失敗しました");
			}
		}
	}

	static  boolean validNum(int myHand,int yourHand,int[] myvalidValues,int[] yourvalidValues ){
		boolean result = false;
	    if(myHand >= myvalidValues[0] && myHand <= myvalidValues[1] &&
	    yourHand >= yourvalidValues[0] && yourHand <= yourvalidValues[1]){
	    	return true;
	    }
		return result;
	}

	static String janKen(int myHand,int yourHand){
		switch(myHand - yourHand){
		case -1:
		case 2 :
			return KATI;
		case 0 :
			return AIKO;
		default :
			return MAKE;
	}

	}
}
0