結果

問題 No.2751 429-like Number
コンテスト
ユーザー ntuda
提出日時 2024-05-12 20:48:19
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 402 ms / 4,000 ms
コード長 804 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 119 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 88,552 KB
最終ジャッジ日時 2026-05-27 10:49:03
合計ジャッジ時間 8,523 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def seachPrimeNum(N):
    if N == 2:
        return []
    max = int(N ** 0.5)
    seachList = [i for i in range(2, N + 1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

PL = seachPrimeNum(10 ** 5)

for _ in range(int(input())):
    a = int(input())
    cnt = 0
    j = False
    for p in PL:
        while cnt < 3 and a % p == 0:
            a //= p
            cnt += 1
        if a == 1:
            if cnt == 3:
                j = True
                break
            else:
                break
    else:
        if cnt == 2:
            j = True

    if j == True:
        print("Yes")
    else:
        print("No")
0