結果

問題 No.354 メルセンヌ素数
ユーザー naotest2
提出日時 2017-05-24 12:20:18
言語 Ruby
(3.4.1)
結果
AC  
実行時間 94 ms / 1,000 ms
コード長 197 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-10-02 02:17:06
合計ジャッジ時間 2,132 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:10: warning: `-' after local variable or literal is interpreted as binary operator
Main.rb:10: warning: even though it seems like unary operator
Syntax OK

ソースコード

diff #

P=gets.chomp.to_i

def merusennu(p)
  # c = 0
  # num = 2 ** p - 1
  # while num > 0
  #   c += 1 if num % 2 == 1
  #   num = num >> 1
  # end
  return p + 1 -1
  # return c
end

puts merusennu(P)
0