結果

問題 No.889 素数!
ユーザー tnodinotnodino
提出日時 2022-07-04 18:48:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 747 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-14 10:38:25
合計ジャッジ時間 3,937 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 59 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

def sosu(x):
    for i in range(2,x):
        if x % i == 0:
            return False
    return True

def heihosu(x):
    for i in range(2,x+1):
        if pow(i, 2) == x:
            return True
    return False

def ripposu(x):
    for i in range(2,x+1):
        if pow(i, 3) == x:
            return True
    return False

def kanzensu(x):
    s = 0
    for i in range(1,x+1):
        if x % i == 0:
            s += i
            if x // i != i:
                s += x // i
    if s - x == x:
        return True
    return False

N = int(input())
if N <= 1:
    print(N)
elif sosu(N):
    print('Sosu!')
elif heihosu(N):
    print('Heihosu!')
elif ripposu(N):
    print('Ripposu!')
elif kanzensu(N):
    print('Kanzensu!')
else:
    print(N)
0