結果

問題 No.104 国道
ユーザー fshuto
提出日時 2019-04-30 16:02:51
言語 Ruby
(3.4.1)
結果
AC  
実行時間 99 ms / 5,000 ms
コード長 106 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-12-30 05:10:37
合計ジャッジ時間 3,721 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: `*' after local variable or literal is interpreted as binary operator
Main.rb:6: warning: even though it seems like argument prefix
Main.rb:6: warning: `+' after local variable or literal is interpreted as binary operator
Main.rb:6: warning: even though it seems like unary operator
Syntax OK

ソースコード

diff #

ans = 1
gets.chomp.chars.each do |x|
  if x=='L'
    ans *=2
  else
    ans = ans *2 +1
  end
end
puts ans
0