結果

問題 No.2751 429-like Number
ユーザー KDKJKDKJ
提出日時 2024-06-29 03:24:41
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 875 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 236,160 KB
最終ジャッジ日時 2024-06-29 03:24:55
合計ジャッジ時間 13,677 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 796 ms
231,308 KB
testcase_01 AC 823 ms
230,780 KB
testcase_02 AC 888 ms
230,712 KB
testcase_03 AC 854 ms
230,916 KB
testcase_04 AC 840 ms
230,916 KB
testcase_05 AC 807 ms
230,788 KB
testcase_06 AC 1,040 ms
231,236 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,Counter,deque
from heapq import heappush,heappop


# n以下のすべての素数を列挙する
def eratosthenes_sieve(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = is_prime[1] = False
    primes = set()
    for p in range(2, n + 1):
        if is_prime[p]:
            primes.add(p)
            for q in range(p * p, n + 1, p):
                is_prime[q] = False
    return sorted(list(primes))


def main():
    primes = eratosthenes_sieve(10**7)
    Q = int(input())
    for _ in range(Q):
        a = int(input())
        cnt = 0
        for p in primes:
            while a % p == 0:
                a = a//p
                cnt += 1
        if a > 1:
            cnt += 1
        if cnt == 3:
            print("Yes")
        else:
            print("No")
        
    
    
    



if __name__ == '__main__':
    main()


0