結果
問題 |
No.889 素数!
|
ユーザー |
![]() |
提出日時 | 2020-07-26 09:40:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 750 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-06-28 02:49:01 |
合計ジャッジ時間 | 3,528 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 61 |
ソースコード
def is_sosu(x): if x <= 1: return False i = 2 while i**2 <= x: if x % i == 0: return False i += 1 return True def is_heihosu(x): i = 2 while i**2 <= x: if i**2 == x: return True i += 1 return False def is_ripposu(x): i = 2 while i**3 <= x: if i**3 == x: return True i += 1 return False def is_kanzensu(x): s = 1 i = 2 while i**2 < x: if x % i == 0: s += i + x // i i += 1 if i**2 == x: s += i if x != 1 and x == s: return True return False n = int(input()) ans = n if is_sosu(n): ans = "Sosu!" if is_heihosu(n): ans = "Heihosu!" if is_ripposu(n): ans = "Ripposu!" if is_kanzensu(n): ans = "Kanzensu!" print(ans)