結果

問題 No.161 制限ジャンケン
ユーザー suppy193suppy193
提出日時 2015-06-17 16:44:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 514 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 11,548 KB
実行使用メモリ 15,336 KB
最終ジャッジ日時 2023-08-20 04:36:56
合計ジャッジ時間 2,936 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,220 KB
testcase_01 AC 89 ms
15,248 KB
testcase_02 AC 84 ms
15,136 KB
testcase_03 AC 83 ms
15,264 KB
testcase_04 AC 84 ms
15,088 KB
testcase_05 AC 83 ms
15,268 KB
testcase_06 AC 81 ms
15,296 KB
testcase_07 AC 80 ms
15,040 KB
testcase_08 AC 81 ms
15,148 KB
testcase_09 AC 80 ms
15,284 KB
testcase_10 AC 83 ms
15,156 KB
testcase_11 AC 82 ms
15,336 KB
testcase_12 AC 82 ms
15,152 KB
testcase_13 AC 80 ms
15,232 KB
testcase_14 AC 82 ms
15,172 KB
testcase_15 AC 83 ms
15,212 KB
testcase_16 AC 85 ms
15,252 KB
testcase_17 AC 85 ms
15,036 KB
testcase_18 AC 83 ms
15,208 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