結果

問題 No.264 じゃんけん
ユーザー tsunabittsunabit
提出日時 2018-03-31 23:20:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 1,340 bytes
コンパイル時間 4,345 ms
コンパイル使用メモリ 73,068 KB
実行使用メモリ 56,472 KB
最終ジャッジ日時 2023-09-08 10:23:51
合計ジャッジ時間 5,727 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,688 KB
testcase_01 AC 123 ms
55,844 KB
testcase_02 AC 124 ms
56,472 KB
testcase_03 AC 126 ms
55,640 KB
testcase_04 AC 125 ms
55,804 KB
testcase_05 AC 122 ms
55,792 KB
testcase_06 AC 123 ms
55,596 KB
testcase_07 AC 123 ms
55,652 KB
testcase_08 AC 123 ms
56,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

// 問題文
// 自分と相手がじゃんけんをする。
// じゃんけんの結果を標準出力に出力してください。
// 結果は、自分が勝ったら「Won」、自分が負けたら「Lost」、引き分けなら「Drew」を出力してください。
// 入力
// 0 0
// ぐー, ちょき, ぱーをそれぞれ 0, 1, 2とし、1つ目に自分のが2つ目に相手のが与えられます。
public class No264 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        int j = sc.nextInt();
        int a = sc.nextInt();
        if(j == a) {
            System.out.println("Drew");
        }else if(j == 0) {
            if(a == 1) {
                System.out.println("Won");
            }else if(a == 2) {
                System.out.println("Lost");
            }
        }else if(j == 1) {
            if(a == 0) {
                System.out.println("Lost");
            }else if(a == 2) {
                System.out.println("Won");
            }
        }else if(j == 2) {
            if(a == 0) {
                System.out.println("Won");
            }else if(a == 1) {
                System.out.println("Lost");
            }
        }
    }
}
0