結果

問題 No.2241 Reach 1
ユーザー rlangevin
提出日時 2023-03-10 21:47:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 53,764 KB
最終ジャッジ日時 2024-09-18 04:03:49
合計ジャッジ時間 2,572 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

def popcount(n):
    cnt = 0
    while n:
        cnt += n & 1
        n //= 2
    return cnt

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