結果

問題 No.161 制限ジャンケン
ユーザー cielciel
提出日時 2015-03-09 17:56:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 242 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 11,488 KB
実行使用メモリ 15,296 KB
最終ジャッジ日時 2023-08-20 04:25:06
合計ジャッジ時間 2,583 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,040 KB
testcase_01 AC 85 ms
15,124 KB
testcase_02 AC 81 ms
15,124 KB
testcase_03 AC 77 ms
15,156 KB
testcase_04 AC 78 ms
15,084 KB
testcase_05 AC 76 ms
15,040 KB
testcase_06 AC 80 ms
15,276 KB
testcase_07 AC 76 ms
15,296 KB
testcase_08 AC 79 ms
15,028 KB
testcase_09 AC 79 ms
15,260 KB
testcase_10 AC 78 ms
15,116 KB
testcase_11 AC 79 ms
15,264 KB
testcase_12 AC 81 ms
15,124 KB
testcase_13 AC 80 ms
15,068 KB
testcase_14 AC 77 ms
15,144 KB
testcase_15 AC 79 ms
15,028 KB
testcase_16 AC 81 ms
15,032 KB
testcase_17 AC 80 ms
15,080 KB
testcase_18 AC 80 ms
15,240 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a=Hash[%W(G C P).zip gets.split.map(&:to_i)]
b=Hash[gets.chars.group_by{|e|e}.map{|k,v|[k,v.size]}]
b.default=s=0
s=0
[[?G,?C,3],[?C,?P,3],[?P,?G,3],[?G,?G,1],[?C,?C,1],[?P,?P,1]].each{|x,y,m|
	n=[a[x],b[y]].min
	s+=n*m
	a[x]-=n;b[y]-=n
}
p s
0