結果
問題 | No.642 Two Operations No.1 |
ユーザー |
|
提出日時 | 2018-02-07 15:24:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 297 bytes |
コンパイル時間 | 95 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-09-15 07:31:33 |
合計ジャッジ時間 | 1,192 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
""" 1 - 1 -> 0 2 - 10 -> 1 3 - 11 -> 3 4 - 100 -> 2 5 - 101 -> 5 6 - 110 -> 4 7 - 111 -> 4 8 - 1000 -> 3 9 - 1001 -> 8 10 - 1010 """ def main(): N = int(input()) - 1 if N == 0: print(0) return N_bin = bin(N)[2:] print(len(N_bin) + N_bin.count("0")) main()