結果

問題 No.889 素数!
ユーザー miya145592miya145592
提出日時 2023-05-21 04:25:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 802 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 53,968 KB
最終ジャッジ日時 2024-12-21 14:49:56
合計ジャッジ時間 4,732 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 60 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def heiho(n):
    for i in range(2, n+1):
        if i**2>n:
            break
        if i**2==n:
            return 1
    return 0

def rippo(n):
    for i in range(2, n+1):
        if i**3>n:
            break
        if i**3==n:
            return 1
    return 0

N = int(input())
Y = make_divisors(N)
S = sum(Y[:-1])
if N>=2 and len(Y)==2:
    print("Sosu!")
elif N>=2 and heiho(N):
    print("Heihosu!")
elif N>=2 and rippo(N):
    print("Ripposu!")
elif N==S:
    print("Kanzensu!")
else:
    print(N)
0