結果

問題 No.2751 429-like Number
ユーザー ntuda
提出日時 2024-05-12 20:48:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,709 ms / 4,000 ms
コード長 804 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 83,684 KB
最終ジャッジ日時 2024-12-20 09:15:18
合計ジャッジ時間 24,489 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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