結果
問題 | No.2751 429-like Number |
ユーザー |
|
提出日時 | 2024-05-10 23:38:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 744 bytes |
コンパイル時間 | 202 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 25,672 KB |
最終ジャッジ日時 | 2024-12-20 07:53:33 |
合計ジャッジ時間 | 97,547 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 WA * 2 |
other | AC * 2 WA * 1 TLE * 19 |
ソースコード
def get_prime(n):sieve = [True] * (n + 1)i = 2while i * i <= n:if sieve[i]:for j in range(i * i, n + 1, i):sieve[j] = Falsei += 1return [i for i in range(2, n + 1) if sieve[i]]q = int(input())l = get_prime(100000)for _ in range(q):n = int(input())cnt=0idx=0while cnt < 3 and idx < len(l):if n%l[idx] ==0:cnt+=1n //= l[idx]else:idx += 1if cnt == 3:if n == 1:print('Yes')else:print('No')elif cnt == 2:if n == 1:print('No')else:print(n)print('Yes')else:print('No')