結果

問題 No.423 ハムスター語初級(数詞)
ユーザー harhogefooharhogefoo
提出日時 2016-10-12 11:28:26
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 253 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-05-01 20:18:38
合計ジャッジ時間 1,507 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
12,160 KB
testcase_01 AC 96 ms
12,160 KB
testcase_02 AC 86 ms
12,288 KB
testcase_03 AC 83 ms
12,160 KB
testcase_04 AC 83 ms
12,160 KB
testcase_05 RE -
testcase_06 AC 87 ms
12,160 KB
testcase_07 AC 82 ms
12,288 KB
testcase_08 AC 83 ms
12,160 KB
testcase_09 AC 85 ms
12,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp
ary = Array.new

loop do
  if n[0,4] == "hamu"
    ary.push(1)
    n[0,4] = ""
  else
    ary.push(0)
    n[0,3] = ""
  end
  break if n.length == 0
end
ans = ary.join.to_i(2) * 2
puts "#{ans.to_s(2).gsub!(/1/, 'hamu').gsub!(/0/, 'ham')}"
0