結果

問題 No.889 素数!
ユーザー face4
提出日時 2019-09-16 16:14:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-07 02:24:54
合計ジャッジ時間 3,501 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x):
    if x < 2:
        return x
    isPrime = True
    s = 0
    for i in range(1, x+1):
        if i*i == x:
            return "Heihosu!"
        if i*i*i == x:
            return "Ripposu!"
        if x % i == 0:
            s += i
            if i != 1 and i != x:
                isPrime = False
    if s-x == x:
        return "Kanzensu!"
    return "Sosu!" if isPrime else x

n = int(input())
print(f(n))
0