結果
問題 | No.161 制限ジャンケン |
ユーザー | zeroyonichihachi |
提出日時 | 2016-10-31 16:01:41 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 446 bytes |
コンパイル時間 | 136 ms |
コンパイル使用メモリ | 11,300 KB |
実行使用メモリ | 15,368 KB |
最終ジャッジ日時 | 2023-08-16 11:40:43 |
合計ジャッジ時間 | 3,017 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 81 ms
15,140 KB |
testcase_02 | AC | 84 ms
15,228 KB |
testcase_03 | AC | 83 ms
15,292 KB |
testcase_04 | WA | - |
testcase_05 | AC | 82 ms
15,140 KB |
testcase_06 | AC | 82 ms
15,180 KB |
testcase_07 | AC | 81 ms
15,096 KB |
testcase_08 | AC | 83 ms
15,048 KB |
testcase_09 | AC | 81 ms
15,160 KB |
testcase_10 | AC | 83 ms
15,176 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 81 ms
15,040 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
コンパイルメッセージ
Syntax OK
ソースコード
def win(te) case te when "G" then "P" when "C" then "G" when "P" then "C" end end tes = %w[G C P] limits = [tes, gets.split(" ").map(&:to_i)]. transpose.reduce({}){|h, (k,v)| h[k]=v; h} sum = 0 gets.chomp.chars.each do |aite| me = win(aite) case when limits[me] > 0 sum += 3 limits[me] -= 1 when limits[aite] > 0 sum += 1 limits[aite] -= 1 else limits[(tes - [me, aite]).first] -= 1 end end p sum