結果

問題 No.312 置換処理
ユーザー todo_2mariko
提出日時 2019-03-20 16:31:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 334 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-15 12:26:40
合計ジャッジ時間 3,920 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = n
table = set()
i = 2

while i * i <= n:
    while n % i == 0:
        n = n // i
        table.add(i)
    i += 1
if n > 1:
    table.add(n)
    
ans = sorted(list(table))
# print(ans)
if len(ans) >= 2:
    if ans[0] == 2:
        if a % 4 == 0 and ans[1] != 3:
            print(4)
        else:
            print(ans[1])
    else:
        print(ans[0])
else:
    print([4, ans[0]][ans[0]!=2])
0