結果

問題 No.264 じゃんけん
ユーザー hippolover02hippolover02
提出日時 2022-07-09 17:20:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 967 bytes
コンパイル時間 3,024 ms
コンパイル使用メモリ 72,080 KB
実行使用メモリ 56,228 KB
最終ジャッジ日時 2023-08-30 01:06:01
合計ジャッジ時間 5,059 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,040 KB
testcase_01 AC 124 ms
55,808 KB
testcase_02 AC 125 ms
56,104 KB
testcase_03 AC 122 ms
56,228 KB
testcase_04 AC 124 ms
55,916 KB
testcase_05 AC 124 ms
56,176 KB
testcase_06 AC 122 ms
56,080 KB
testcase_07 AC 121 ms
56,040 KB
testcase_08 AC 121 ms
56,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 自分と相手がじゃんけんをする。
// じゃんけんの結果を標準出力に出力してください。
// 結果は、自分が勝ったら「Won」、自分が負けたら「Lost」、引き分けなら「Drew」を出力してください。
// ぐー, ちょき, ぱーをそれぞれ 0, 1, 2とし、1つ目に自分のが2つ目に相手のが与えられます。

import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ!!
        Scanner sc = new Scanner(System.in);
        int me = sc.nextInt();
        int you = sc.nextInt();
        String result = "";
        if (me == you){
            result = "Drew";
        }else if((me == 0 && you == 1) || (me == 1 && you == 2) || (me == 2 && you == 0)) {
            result = "Won";
        } else {
            result = "Lost";
        }
        System.out.println(result);
    }
}
0