結果
問題 |
No.2751 429-like Number
|
ユーザー |
![]() |
提出日時 | 2024-06-29 03:25:40 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 898 bytes |
コンパイル時間 | 147 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 78,192 KB |
最終ジャッジ日時 | 2024-06-29 03:26:16 |
合計ジャッジ時間 | 28,749 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 6 |
other | WA * 22 |
ソースコード
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**5) print(len(primes)) 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()