結果

問題 No.378 名声値を稼ごう
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2016-06-27 12:48:52
言語 Ruby
(3.2.2)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 11,524 KB
実行使用メモリ 15,304 KB
最終ジャッジ日時 2023-09-12 00:55:00
合計ジャッジ時間 1,245 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,100 KB
testcase_01 AC 83 ms
15,160 KB
testcase_02 AC 82 ms
15,252 KB
testcase_03 AC 83 ms
15,304 KB
testcase_04 AC 83 ms
15,036 KB
testcase_05 AC 81 ms
15,156 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - m
Syntax OK

ソースコード

diff #

def each_exp(num)
    current = num
    Enumerator.new {|y|
        while current > 0
            y << current
            r,m = current.divmod(2)
            current = r
        end
    }
end
n = gets.to_i

puts n * 2 - each_exp(n).inject(0,&:+)


0