結果

問題 No.642 Two Operations No.1
ユーザー kichirb3kichirb3
提出日時 2018-03-07 08:09:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 11,984 KB
実行使用メモリ 10,068 KB
最終ジャッジ日時 2023-10-24 18:39:39
合計ジャッジ時間 1,074 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,068 KB
testcase_01 AC 28 ms
10,068 KB
testcase_02 AC 28 ms
10,068 KB
testcase_03 AC 28 ms
10,068 KB
testcase_04 AC 26 ms
10,068 KB
testcase_05 AC 26 ms
10,068 KB
testcase_06 AC 28 ms
10,068 KB
testcase_07 AC 27 ms
10,068 KB
testcase_08 AC 27 ms
10,068 KB
testcase_09 AC 27 ms
10,068 KB
testcase_10 AC 27 ms
10,068 KB
testcase_11 AC 27 ms
10,068 KB
testcase_12 AC 26 ms
10,068 KB
testcase_13 AC 27 ms
10,068 KB
testcase_14 AC 26 ms
10,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.642 Two Operations No.1
https://yukicoder.me/problems/no/642

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N):
    ans = 0
    while N != 1:
        if N % 2 == 0:
            N //= 2
        else:
            N += 1
        ans += 1
    return ans


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
0