結果
| 問題 | 
                            No.889 素数!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-05-21 04:29:18 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 41 ms / 2,000 ms | 
| コード長 | 811 bytes | 
| コンパイル時間 | 181 ms | 
| コンパイル使用メモリ | 82,312 KB | 
| 実行使用メモリ | 52,224 KB | 
| 最終ジャッジ日時 | 2024-12-21 14:53:01 | 
| 合計ジャッジ時間 | 4,404 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 61 | 
ソースコード
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>=1 and N==S:
    print("Kanzensu!")
else:
    print(N)