結果

問題 No.2241 Reach 1
ユーザー FromBooskaFromBooska
提出日時 2023-05-01 11:28:32
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 547 bytes
コンパイル時間 1,232 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 80,340 KB
最終ジャッジ日時 2023-08-12 20:10:06
合計ジャッジ時間 7,407 ms
ジャッジサーバーID
(参考情報)
judge8 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 73 ms
70,852 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 72 ms
71,336 KB
testcase_05 AC 69 ms
71,100 KB
testcase_06 RE -
testcase_07 AC 71 ms
71,312 KB
testcase_08 RE -
testcase_09 AC 69 ms
71,288 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 72 ms
71,248 KB
testcase_19 RE -
testcase_20 AC 73 ms
71,372 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 70 ms
71,016 KB
testcase_25 RE -
testcase_26 AC 72 ms
71,252 KB
testcase_27 RE -
testcase_28 AC 70 ms
71,184 KB
testcase_29 AC 71 ms
71,232 KB
testcase_30 AC 71 ms
71,180 KB
testcase_31 RE -
testcase_32 AC 73 ms
71,256 KB
testcase_33 RE -
testcase_34 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 公式解説より
# N=1なら0回
# Nが2のべき乗ならば1回
# それ以外で奇数ならばkをかけて+1することで2のべき乗にできるので2回(これは疑ったけどわからなかった)
# 偶数ならば、奇数にしてから同じことができるので3回

N = int(input())
if N == 1:
    print(0)
else:
    m = N
    if m%2 == 0:
        count += 1
        while m%2 == 0:
            m //= 2
    if m == 1:
        print(1)
    else:
        if N%2 == 0:
            print(3)
        else:
            print(2)
0