結果

問題 No.642 Two Operations No.1
ユーザー はむ吉🐹はむ吉🐹
提出日時 2018-02-02 21:52:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 71,272 KB
最終ジャッジ日時 2023-08-30 02:09:05
合計ジャッジ時間 2,367 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,272 KB
testcase_01 AC 69 ms
71,204 KB
testcase_02 AC 70 ms
71,120 KB
testcase_03 AC 71 ms
71,272 KB
testcase_04 AC 71 ms
70,852 KB
testcase_05 AC 71 ms
71,124 KB
testcase_06 AC 71 ms
71,188 KB
testcase_07 AC 72 ms
71,136 KB
testcase_08 AC 70 ms
71,256 KB
testcase_09 AC 71 ms
71,024 KB
testcase_10 AC 69 ms
71,160 KB
testcase_11 AC 71 ms
71,132 KB
testcase_12 AC 69 ms
71,232 KB
testcase_13 AC 71 ms
71,040 KB
testcase_14 AC 70 ms
71,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env pypy3


def min_num_ops(n):
    assert 1 <= n
    res = 0
    while n > 1:
        res += 1
        d, m = divmod(n, 2)
        if m == 0:
            n = d
        else:
            n += 1
    return res


def main():
    print(min_num_ops(int(input())))


if __name__ == '__main__':
    main()
0