結果
| 問題 | No.2795 Perfect Number |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-28 21:55:10 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 367 bytes |
| 記録 | |
| コンパイル時間 | 321 ms |
| コンパイル使用メモリ | 85,320 KB |
| 実行使用メモリ | 53,872 KB |
| 最終ジャッジ日時 | 2026-03-18 02:37:36 |
| 合計ジャッジ時間 | 1,958 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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")