結果

問題 No.312 置換処理
ユーザー lam6er
提出日時 2025-04-16 15:26:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 58,828 KB
最終ジャッジ日時 2025-04-16 15:28:16
合計ジャッジ時間 2,853 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

def find_min_factor(m):
    i = 3
    while i * i <= m:
        if m % i == 0:
            return i
        i += 2
    return m

n = int(input())
if n % 2 == 1:
    f = find_min_factor(n)
    print(f)
else:
    e = 0
    m = n
    while m % 2 == 0:
        m //= 2
        e += 1
    if m == 1:
        print(4)
    else:
        f = find_min_factor(m)
        if e >= 2:
            print(min(4, f))
        else:
            print(f)
0