結果

問題 No.642 Two Operations No.1
ユーザー 0w10w1
提出日時 2018-03-18 12:30:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 196 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 7,964 KB
最終ジャッジ日時 2023-08-26 21:40:13
合計ジャッジ時間 1,074 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
7,768 KB
testcase_01 AC 12 ms
7,796 KB
testcase_02 AC 14 ms
7,920 KB
testcase_03 AC 13 ms
7,836 KB
testcase_04 AC 13 ms
7,776 KB
testcase_05 AC 14 ms
7,848 KB
testcase_06 AC 13 ms
7,796 KB
testcase_07 AC 13 ms
7,884 KB
testcase_08 AC 13 ms
7,960 KB
testcase_09 AC 13 ms
7,888 KB
testcase_10 AC 12 ms
7,964 KB
testcase_11 AC 12 ms
7,932 KB
testcase_12 AC 13 ms
7,748 KB
testcase_13 AC 13 ms
7,748 KB
testcase_14 AC 13 ms
7,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ans = 0x3f3f3f3f
for i in range(0, 31):
    u = (1 << i) - n
    if u < 0: continue
    c = i
    while u > 0:
        c += u & 1
        u >>= 1
    ans = min(ans, c)
print(ans)
0