結果

問題 No.3055 Simple Chicken Game
ユーザー gew1fw
提出日時 2025-06-12 15:05:16
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 291 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 82,676 KB
実行使用メモリ 67,324 KB
最終ジャッジ日時 2025-06-12 15:06:03
合計ジャッジ時間 2,920 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
count = 0
k = 0
while (1 << k) <= n:
    two_k = 1 << k
    two_k_plus_1 = two_k << 1
    blocks = (n + 1) // two_k_plus_1
    count += blocks * two_k
    remainder = (n + 1) % two_k_plus_1
    if remainder > two_k:
        count += remainder - two_k
    k += 1
print(count)
0