結果
| 問題 |
No.2795 Perfect Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-28 21:55:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 367 bytes |
| コンパイル時間 | 175 ms |
| コンパイル使用メモリ | 82,252 KB |
| 実行使用メモリ | 53,924 KB |
| 最終ジャッジ日時 | 2024-06-28 21:55:14 |
| 合計ジャッジ時間 | 3,079 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 30 WA * 5 |
ソースコード
from sys import stdin
from math import sqrt
n = int(stdin.readline())
a = 2
res = False
def is_prime(num):
result = False
for i in range(2, int(sqrt(num))+1):
if num % i == 0:
result = True
break
return result
for i in range(1, 31):
if (2 ** (i - 1)) * (2 ** i - 1) == n and is_prime(i):
res = True
break
if res:
print("Yes")
else:
print("No")