結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
|
提出日時 | 2019-08-08 11:22:20 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,075 ms / 5,000 ms |
コード長 | 694 bytes |
コンパイル時間 | 88 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-18 19:17:55 |
合計ジャッジ時間 | 13,640 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
def factorize(n): if n == 1: return [(1, 1)] factors = [] for div in range(2, int(n**0.5) + 1): cnt = 0 while n % div == 0: n //= div cnt += 1 if cnt > 0: factors.append((div, cnt)) if n > 1: factors.append((n, 1)) return factors N = int(input()) factors = factorize(N) if len(factors) == 1: _, cnt = factors[0] if cnt >= 3: print('YES') else: print('NO') elif len(factors) == 2: _, cnt1 = factors[0] _, cnt2 = factors[1] if cnt1 >= 2 or cnt2 >= 2: print('YES') else: print('NO') else: print('YES')