結果

問題 No.161 制限ジャンケン
ユーザー suppy193suppy193
提出日時 2015-06-17 16:44:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 5,000 ms
コード長 514 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-05-07 12:07:51
合計ジャッジ時間 2,507 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
12,288 KB
testcase_01 AC 79 ms
12,288 KB
testcase_02 AC 77 ms
12,160 KB
testcase_03 AC 79 ms
12,288 KB
testcase_04 AC 79 ms
12,032 KB
testcase_05 AC 75 ms
12,032 KB
testcase_06 AC 78 ms
12,160 KB
testcase_07 AC 79 ms
12,160 KB
testcase_08 AC 80 ms
12,288 KB
testcase_09 AC 81 ms
12,160 KB
testcase_10 AC 80 ms
12,160 KB
testcase_11 AC 81 ms
12,032 KB
testcase_12 AC 83 ms
12,160 KB
testcase_13 AC 84 ms
12,160 KB
testcase_14 AC 81 ms
12,160 KB
testcase_15 AC 77 ms
12,160 KB
testcase_16 AC 74 ms
12,160 KB
testcase_17 AC 77 ms
12,288 KB
testcase_18 AC 75 ms
12,032 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

yuki = gets.chomp.split(' ').map {|i| i.to_i}
s = gets.chomp
aite = [s.scan('G').length, s.scan('C').length, s.scan('P').length]
#p yuki
#p s
#p aite
aite.push(aite.shift)
point = 0
(0...3).each do |i|
	if yuki[i] >= aite[i]
		point += 3 * aite[i]
		yuki[i] -= aite[i]
		aite[i] = 0
	else
		point += 3 * yuki[i]
		aite[i] -= yuki[i]
		yuki[i] = 0
	end
end
#puts point
aite.unshift(aite.pop)
#p yuki
#p aite
(0...3).each do |i|
	if aite[i] >= yuki[i]
		point += yuki[i]
	else
		point += aite[i]
	end
end
puts point
0