結果

問題 No.642 Two Operations No.1
ユーザー brthyyjpbrthyyjp
提出日時 2020-06-10 02:28:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 161 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 71,580 KB
最終ジャッジ日時 2023-09-02 10:09:09
合計ジャッジ時間 2,260 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,536 KB
testcase_01 AC 74 ms
71,416 KB
testcase_02 AC 74 ms
71,416 KB
testcase_03 AC 74 ms
71,512 KB
testcase_04 AC 75 ms
71,512 KB
testcase_05 AC 73 ms
71,292 KB
testcase_06 AC 74 ms
71,536 KB
testcase_07 AC 73 ms
71,124 KB
testcase_08 AC 73 ms
71,368 KB
testcase_09 AC 75 ms
71,384 KB
testcase_10 AC 75 ms
71,328 KB
testcase_11 AC 73 ms
71,516 KB
testcase_12 AC 74 ms
71,408 KB
testcase_13 AC 76 ms
71,228 KB
testcase_14 AC 78 ms
71,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

if n == 1:
    print(0)
    exit()

b = format(n-1, 'b')

ans = len(b)
for i in range(len(b)):
    if b[i] == '0':
        ans += 1
print(ans)
0