結果
問題 | No.264 じゃんけん |
ユーザー | oyafuso |
提出日時 | 2019-03-11 14:02:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 122 ms / 5,000 ms |
コード長 | 1,212 bytes |
コンパイル時間 | 2,165 ms |
コンパイル使用メモリ | 74,648 KB |
実行使用メモリ | 56,292 KB |
最終ジャッジ日時 | 2023-09-05 20:06:57 |
合計ジャッジ時間 | 4,107 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 122 ms
56,196 KB |
testcase_01 | AC | 121 ms
56,292 KB |
testcase_02 | AC | 119 ms
56,020 KB |
testcase_03 | AC | 120 ms
56,100 KB |
testcase_04 | AC | 119 ms
55,756 KB |
testcase_05 | AC | 120 ms
55,760 KB |
testcase_06 | AC | 118 ms
56,072 KB |
testcase_07 | AC | 120 ms
55,864 KB |
testcase_08 | AC | 121 ms
55,764 KB |
ソースコード
import java.util.*; class Main { private static final String SPLIT_STR = " "; private static final int CASE_ROCK = 0; private static final int CASE_PAPER = 2; private static final int CASE_SCISSORS = 1; private static final String RESULT_WIN = "Won"; private static final String RESULT_LOSE = "Lost"; private static final String RESULT_DRAW = "Drew"; private static final String[] RESULT_ARRAY = {RESULT_DRAW, RESULT_WIN, RESULT_LOSE}; public static void main(String[] args) { // Scanner生成 Scanner sc = new Scanner(System.in); // 入力設定 String input = sc.nextLine(); String[] split = input.split(SPLIT_STR); List<Integer> numList = new ArrayList<>(split.length); for (int i = 0; i < split.length; i++) { numList.add(Integer.parseInt(split[i])); } // Scannerクローズ sc.close(); /* メイン処理開始 */ // 変数初期化 String result = ""; int N = numList.get(0); int K = numList.get(1); // 結果設定 for (int i = 0; i < RESULT_ARRAY.length; i++) { if (N == K) { result = RESULT_ARRAY[i]; } N = (N + 1) == RESULT_ARRAY.length ? 0 : N + 1; } /* メイン処理終了 */ // 結果出力 System.out.println(result); } }