結果

問題 No.2751 429-like Number
ユーザー mottchanmottchan
提出日時 2024-05-10 23:38:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 746 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,720 KB
最終ジャッジ日時 2024-05-10 23:38:55
合計ジャッジ時間 6,346 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
11,776 KB
testcase_01 AC 46 ms
11,904 KB
testcase_02 AC 72 ms
12,032 KB
testcase_03 AC 72 ms
11,776 KB
testcase_04 AC 49 ms
12,032 KB
testcase_05 AC 49 ms
11,776 KB
testcase_06 AC 96 ms
11,776 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 #

def get_prime(n):
    sieve = [True] * (n + 1) 
    i = 2
    while i * i <= n: 
        if sieve[i]:
            for j in range(i * i, n + 1, i):
                sieve[j] = False
        i += 1
    return [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=0
    idx=0
    while cnt < 3 and idx < len(l):
        if n%l[idx] ==0:
            cnt+=1
            n //= l[idx]
        else:
            idx += 1

    if 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')
    
0