結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2015-06-17 16:46:23 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 5,000 ms |
| コード長 | 570 bytes |
| コンパイル時間 | 172 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-11-30 04:44:41 |
| 合計ジャッジ時間 | 2,712 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
コンパイルメッセージ
Syntax OK
ソースコード
yuki = gets.chomp.split(' ').map {|i| i.to_i}
s = gets.chomp
opponent = [s.scan('G').length, s.scan('C').length, s.scan('P').length]
#p yuki
#p s
#p opponent
opponent.push(opponent.shift)
point = 0
(0...3).each do |i|
if yuki[i] >= opponent[i]
point += 3 * opponent[i]
yuki[i] -= opponent[i]
opponent[i] = 0
else
point += 3 * yuki[i]
opponent[i] -= yuki[i]
yuki[i] = 0
end
end
#puts point
opponent.unshift(opponent.pop)
#p yuki
#p opponent
(0...3).each do |i|
if opponent[i] >= yuki[i]
point += yuki[i]
else
point += opponent[i]
end
end
puts point
suppy193