結果

問題 No.36 素数が嫌い!
ユーザー leno
提出日時 2017-08-20 14:49:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,732 ms / 5,000 ms
コード長 586 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-27 01:14:34
合計ジャッジ時間 11,309 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def twice_decomposition(N):
    if N in [1, 2, 3]:
        return []
    i = 2
    cnt = 0
    lst = []
    while i * i <= N:
        while N % i == 0:
            if cnt >= 2:
                lst.append(N)
                return lst
            N /= i
            lst.append(i)
            cnt += 1
        i += 1
    return lst


if __name__ == '__main__':
    N = int(input())
    ls = twice_decomposition(N)
    try:
        if ls[0] * ls[1] == N:
            print('NO')
        else:
            print('YES')
    except IndexError:
        print('NO')
0