結果

問題 No.264 じゃんけん
ユーザー matsuyoshi30matsuyoshi30
提出日時 2015-12-31 23:04:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 1,117 bytes
コンパイル時間 2,413 ms
コンパイル使用メモリ 74,896 KB
実行使用メモリ 57,576 KB
最終ジャッジ日時 2023-10-19 12:55:25
合計ジャッジ時間 3,978 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
57,464 KB
testcase_01 AC 129 ms
57,444 KB
testcase_02 AC 128 ms
57,448 KB
testcase_03 AC 127 ms
57,348 KB
testcase_04 AC 130 ms
57,548 KB
testcase_05 AC 128 ms
57,576 KB
testcase_06 AC 128 ms
57,492 KB
testcase_07 AC 127 ms
57,500 KB
testcase_08 AC 131 ms
57,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String xx = in.next();
        String yy = in.next();
        int x = Integer.parseInt(xx);
        int y = Integer.parseInt(yy);

        //0 -> ROCK, 1 -> SCISSORS, 2 -> PAPER
        //0 > 1, 1 > 2, 2 > 0
        try {
            if(x == y) {
                System.out.println("Drew");
            }
            switch(x) {
                case 0:
                    if(y == 1) System.out.println("Won");
                    if(y == 2) System.out.println("Lost");
                    break;
                case 1:
                    if(y == 0)  System.out.println("Lost");
                    if(y == 2)  System.out.println("Won");
                    break;
                case 2:
                    if(y == 0)  System.out.println("Won");
                    if(y == 1)  System.out.println("Lost");
                    break;
                default:
                    break;
            }
        } catch(Exception e) {
            System.exit(0);
        }
    }
}
0