結果

問題 No.889 素数!
ユーザー tokutaro
提出日時 2019-11-23 00:04:19
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-11 06:33:29
合計ジャッジ時間 2,643 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 59 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def is_sosu(n):
    if n < 2:
        return False
    if n == 2:
        return True
    for i in range(2, int(math.sqrt(n) + 1)):
        if n % i == 0:
            return False
    return True

def is_kanzensu(n):
    SUM = 0
    for i in range(1, n):
        if n % i == 0:
            SUM += i
    return SUM == n

def is_heihosu(n):
    return int(math.sqrt(n)) == math.sqrt(n)

def is_ripposu(n):
    return int(pow(n, 1.0/3.0)) == pow(n, 1.0/3.0)

N = input()

if is_sosu(N):
    print('Sosu!')
    quit()
elif is_heihosu(N):
    print('Heihosu!')
    quit()
elif is_ripposu(N):
    print('Ripposu!')
    quit()
elif is_kanzensu(N):
    print('Kanzensu!')
    quit()
else:
    print(str(N))
0