結果

問題 No.889 素数!
ユーザー dango
提出日時 2023-06-07 21:20:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 837 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 81,880 KB
実行使用メモリ 54,624 KB
最終ジャッジ日時 2024-12-30 03:12:12
合計ジャッジ時間 4,891 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 59 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

def ISPRIME(N):
    if N < 2:
        return False
    elif N == 2:
        return True
    elif N % 2 == 0:
        return False
    else:
        for i in range(3, int(N ** 0.5) + 1):
            if N % i == 0:
                return False
    return True

def ISSQUARE(N):
    return float(N ** 0.5).is_integer()

def ISCUBIC(N):
    return float(N ** (1 / 3)).is_integer()

def ISPERFECT(N):
    divisors = []
    for i in range(1, N + 1):
        if N % i == 0:
            divisors.append(N)
            divisors.append(int(N / i))
    return sum(list(set(divisors))[0:len(list(set(divisors))) - 1]) == N

N = int(input())
if N == 0 or N == 1:
  print(N)
elif ISPRIME(N):
    print("Sosu!")
elif ISSQUARE(N):
    print("Heihosu!")
elif ISCUBIC(N):
    print("Ripposu!")
elif ISPERFECT(N):
    print("Kanzensu!")
else:
    print(N)
0