結果

問題 No.36 素数が嫌い!
ユーザー nohakai3nohakai3
提出日時 2022-10-20 14:07:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 225 ms / 5,000 ms
コード長 640 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 75,816 KB
最終ジャッジ日時 2023-09-12 19:30:46
合計ジャッジ時間 6,906 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
75,512 KB
testcase_01 AC 191 ms
75,432 KB
testcase_02 AC 70 ms
71,136 KB
testcase_03 AC 72 ms
71,628 KB
testcase_04 AC 73 ms
71,756 KB
testcase_05 AC 74 ms
75,304 KB
testcase_06 AC 74 ms
75,436 KB
testcase_07 AC 74 ms
75,608 KB
testcase_08 AC 76 ms
75,512 KB
testcase_09 AC 74 ms
75,520 KB
testcase_10 AC 74 ms
75,312 KB
testcase_11 AC 124 ms
75,816 KB
testcase_12 AC 225 ms
75,528 KB
testcase_13 AC 219 ms
75,624 KB
testcase_14 AC 164 ms
75,188 KB
testcase_15 AC 72 ms
71,568 KB
testcase_16 AC 72 ms
71,516 KB
testcase_17 AC 72 ms
70,984 KB
testcase_18 AC 74 ms
75,452 KB
testcase_19 AC 132 ms
75,712 KB
testcase_20 AC 223 ms
75,496 KB
testcase_21 AC 189 ms
75,200 KB
testcase_22 AC 190 ms
75,436 KB
testcase_23 AC 143 ms
75,312 KB
testcase_24 AC 151 ms
75,620 KB
testcase_25 AC 152 ms
75,476 KB
testcase_26 AC 167 ms
75,564 KB
testcase_27 AC 201 ms
75,812 KB
testcase_28 AC 162 ms
75,588 KB
testcase_29 AC 219 ms
75,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n=int(input())
l=factorization(n)

if len(l)>=3:
    exit(print("YES"))

else:
    cnt=0
    for x in l:
        cnt+=x[1]
    if cnt>=3:
        print("YES")
    else:
        print("NO")
0