結果
| 問題 | No.889 素数! |
| コンテスト | |
| ユーザー |
toshiro_yanagi
|
| 提出日時 | 2020-07-26 09:38:25 |
| 言語 | Python3 (3.14.2 + numpy 2.4.0 + scipy 1.16.3) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 739 bytes |
| 記録 | |
| コンパイル時間 | 209 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-06-28 02:45:09 |
| 合計ジャッジ時間 | 4,055 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 59 WA * 2 |
ソースコード
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 == 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)
toshiro_yanagi