結果
| 問題 |
No.2751 429-like Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-13 00:25:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,891 ms / 4,000 ms |
| コード長 | 524 bytes |
| コンパイル時間 | 378 ms |
| コンパイル使用メモリ | 81,916 KB |
| 実行使用メモリ | 78,384 KB |
| 最終ジャッジ日時 | 2024-12-20 09:19:41 |
| 合計ジャッジ時間 | 20,635 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 22 |
ソースコード
import math
ps=[True]*(10**5)
ps[0], ps[1]=False, False
for i in range(2, len(ps)):
j=2
if ps[i]==False: continue
while i*j<len(ps):
ps[i*j]=False
j+=1
p=[]
for i in range(len(ps)):
if ps[i]:
p.append(i)
Q=int(input())
def isOk(x):
count=0
kijun=math.floor(math.sqrt(x))+9
for elm in p:
if elm>kijun: continue
while x%elm==0:
x//=elm
count+=1
if count>3: return 0
if x!=1: count+=1
return [0, 1][count==3]
for _ in range(Q):
print(["No", "Yes"][isOk(int(input()))])