結果

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

ソースコード

diff #

N = int(input())

def prime(n):
    if n == 1:
        return False
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

if prime(N):
    print(N)
    exit()
elif N % 2 == 0 and prime(N/2) and N//2 > 2:
    print(N//2)
    exit()

m = 3
while N % m != 0:
    m += 1

print(m)
0