結果

問題 No.161 制限ジャンケン
ユーザー suppy193suppy193
提出日時 2015-06-17 16:39:55
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 15,420 KB
最終ジャッジ日時 2023-09-21 09:20:56
合計ジャッジ時間 2,545 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 77 ms
15,092 KB
testcase_02 AC 76 ms
15,180 KB
testcase_03 AC 76 ms
15,304 KB
testcase_04 AC 76 ms
15,044 KB
testcase_05 AC 78 ms
15,004 KB
testcase_06 AC 77 ms
15,196 KB
testcase_07 WA -
testcase_08 AC 77 ms
15,300 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 76 ms
15,100 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 76 ms
15,276 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 76 ms
15,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] >= 0
		point += yuki[i]
	end
end
puts point
0