結果
| 問題 |
No.264 じゃんけん
|
| コンテスト | |
| ユーザー |
velfare_nagata
|
| 提出日時 | 2016-10-04 18:19:47 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,565 bytes |
| コンパイル時間 | 3,438 ms |
| コンパイル使用メモリ | 75,036 KB |
| 実行使用メモリ | 54,620 KB |
| 最終ジャッジ日時 | 2024-11-21 15:57:16 |
| 合計ジャッジ時間 | 5,197 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 RE * 3 |
ソースコード
package yukicoder;
import java.util.Hashtable;
import java.util.Scanner;
public class Answer {
/**
* 自分と相手がじゃんけんをする。
* じゃんけんの結果を標準出力に出力してください。
* 結果は、自分が勝ったら「Won」、自分が負けたら「Lost」、引き分けなら「Drew」を出力してください。
* ぐー, ちょき, ぱーをそれぞれ 0, 1, 2とし、1つ目に自分のが2つ目に相手のが与えられます。
*/
public static void main(String[] args) {
// パラメータ取得
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
sc.close();
// じゃんけんの手をそれぞれ下記の通りに管理
// グー:1、チョキ:2、パー:4
int[] rpsData = new int[3];
rpsData[0] = 1;
rpsData[1] = 2;
rpsData[2] = 4;
// 2人でじゃんけんをした場合の勝者の組み合わせを下記の通りに管理
// キーがない組み合わせはあいこ
Hashtable<Integer, Integer> rpsWinTable = new Hashtable<Integer, Integer>();
rpsWinTable.put(1 | 2, 1);
rpsWinTable.put(2 | 4, 2);
rpsWinTable.put(4 | 1, 4);
int w = rpsWinTable.get(rpsData[n] | rpsData[k]);
if(!rpsWinTable.containsKey(rpsData[n] | rpsData[k])){
System.out.println( "Drew");
}else {
System.out.println( (rpsWinTable.get(rpsData[n] | rpsData[k]) == rpsData[n]) ? "Won" : "Lost");
}
}
}
velfare_nagata