結果
問題 |
No.889 素数!
|
ユーザー |
![]() |
提出日時 | 2019-09-28 10:55:47 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 697 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-01 19:28:38 |
合計ジャッジ時間 | 3,573 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 61 |
ソースコード
import math import sympy def sum_divisors_except_itself(n): ''' 自分自身を除く正の約数の和を返す。 ''' return sum(sympy.divisors(n)[:-1]) n = int(input()) na = int(math.sqrt(n)) sosu = False heiho = False rippo = False kanzen = False # 素数 sosu = True for i in range(na): if n % (i+2) == 0: sosu = False break # 平方数 if n == int(na) ** 2: heiho = True # 立法数 if n == math.pow(n, 1.0/3.0) ** 2: rippo = True # 完全数 if n == sum_divisors_except_itself(n): kanzen = True if sosu is True: print("Sosu!") elif heiho is True: print("Heihosu!") elif rippo is True: print("Ripposu!") else: print(n)