結果

問題 No.642 Two Operations No.1
ユーザー NoaSaber
提出日時 2021-03-12 22:21:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 59,264 KB
最終ジャッジ日時 2024-10-14 12:50:09
合計ジャッジ時間 1,676 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
ans=float("inf")
for i in range(40):
    memo=2**i-N
    tmp=0
    if 2**i<N:
        continue
    for j in range(1,41):
        if memo%2==1:
            tmp+=1
        memo//=2
    ans=min(ans,i+tmp)
print(ans)
0