結果

問題 No.354 メルセンヌ素数
ユーザー naotest2naotest2
提出日時 2017-05-24 12:14:04
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 165 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 11,856 KB
実行使用メモリ 91,672 KB
最終ジャッジ日時 2023-10-19 19:55:56
合計ジャッジ時間 3,869 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
20,396 KB
testcase_01 AC 86 ms
16,048 KB
testcase_02 AC 88 ms
16,048 KB
testcase_03 AC 85 ms
16,048 KB
testcase_04 AC 89 ms
16,308 KB
testcase_05 AC 92 ms
17,676 KB
testcase_06 AC 131 ms
28,416 KB
testcase_07 AC 523 ms
70,060 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 c
end

puts merusennu(P)
0