結果

問題 No.642 Two Operations No.1
ユーザー NoaSaberNoaSaber
提出日時 2021-03-12 22:21:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 58,880 KB
最終ジャッジ日時 2024-04-22 13:22:28
合計ジャッジ時間 2,123 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
58,880 KB
testcase_01 AC 64 ms
58,880 KB
testcase_02 AC 59 ms
58,880 KB
testcase_03 AC 58 ms
58,880 KB
testcase_04 AC 51 ms
51,712 KB
testcase_05 AC 51 ms
51,968 KB
testcase_06 AC 51 ms
51,840 KB
testcase_07 AC 55 ms
51,328 KB
testcase_08 AC 50 ms
51,712 KB
testcase_09 AC 50 ms
51,712 KB
testcase_10 AC 50 ms
51,968 KB
testcase_11 AC 53 ms
51,584 KB
testcase_12 AC 41 ms
51,584 KB
testcase_13 AC 41 ms
51,456 KB
testcase_14 AC 40 ms
51,712 KB
権限があれば一括ダウンロードができます

ソースコード

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