結果
| 問題 | No.2795 Perfect Number | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-06-28 21:56:00 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 367 bytes | 
| コンパイル時間 | 144 ms | 
| コンパイル使用メモリ | 82,276 KB | 
| 実行使用メモリ | 54,156 KB | 
| 最終ジャッジ日時 | 2024-06-28 21:56:08 | 
| 合計ジャッジ時間 | 2,554 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 31 WA * 4 | 
ソースコード
from sys import stdin
from math import sqrt
n = int(stdin.readline())
a = 2
res = False
def is_prime(num):
	result = True
	for i in range(2, int(sqrt(num))+1):
		if num % i == 0:
			result = False
			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")
            
            
            
        