結果

問題 No.2751 429-like Number
ユーザー Y.Y.Y.Y.
提出日時 2024-06-02 05:20:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 821 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 76,544 KB
最終ジャッジ日時 2024-06-02 05:20:55
合計ジャッジ時間 6,572 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,224 KB
testcase_01 AC 42 ms
52,224 KB
testcase_02 AC 39 ms
51,968 KB
testcase_03 AC 37 ms
51,968 KB
testcase_04 AC 39 ms
57,600 KB
testcase_05 AC 39 ms
57,728 KB
testcase_06 AC 42 ms
57,216 KB
testcase_07 AC 88 ms
76,544 KB
testcase_08 AC 87 ms
76,544 KB
testcase_09 AC 81 ms
69,760 KB
testcase_10 TLE -
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 #

# GPT-4o出力ベタ貼り
import sys
import math

def count_prime_factors(n):
    if n <= 1:
        return 0
    count = 0
    # Check for number of 2s
    while n % 2 == 0:
        n //= 2
        count += 1
    # Check for number of odd factors
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            n //= i
            count += 1
    # If n is a prime number greater than 2
    if n > 2:
        count += 1
    return count

def main():
    input = sys.stdin.read
    data = input().split()
    Q = int(data[0])
    results = []
    
    for i in range(1, Q + 1):
        A = int(data[i])
        if count_prime_factors(A) == 3:
            results.append("Yes")
        else:
            results.append("No")
    
    print("\n".join(results))

if __name__ == "__main__":
    main()
0