結果
問題 | No.36 素数が嫌い! |
ユーザー | しらっ亭 |
提出日時 | 2015-07-29 03:19:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 574 ms / 5,000 ms |
コード長 | 740 bytes |
コンパイル時間 | 299 ms |
コンパイル使用メモリ | 86,932 KB |
実行使用メモリ | 198,676 KB |
最終ジャッジ日時 | 2023-09-09 07:14:08 |
合計ジャッジ時間 | 10,118 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 303 ms
133,612 KB |
testcase_01 | AC | 453 ms
172,012 KB |
testcase_02 | AC | 77 ms
71,564 KB |
testcase_03 | AC | 77 ms
71,220 KB |
testcase_04 | AC | 75 ms
71,392 KB |
testcase_05 | AC | 82 ms
76,312 KB |
testcase_06 | AC | 82 ms
76,296 KB |
testcase_07 | AC | 81 ms
76,428 KB |
testcase_08 | AC | 80 ms
75,796 KB |
testcase_09 | AC | 78 ms
76,220 KB |
testcase_10 | AC | 81 ms
76,452 KB |
testcase_11 | AC | 239 ms
116,368 KB |
testcase_12 | AC | 571 ms
198,676 KB |
testcase_13 | AC | 574 ms
198,316 KB |
testcase_14 | AC | 372 ms
151,848 KB |
testcase_15 | AC | 76 ms
71,548 KB |
testcase_16 | AC | 76 ms
71,756 KB |
testcase_17 | AC | 77 ms
71,572 KB |
testcase_18 | AC | 79 ms
75,852 KB |
testcase_19 | AC | 272 ms
125,320 KB |
testcase_20 | AC | 574 ms
198,456 KB |
testcase_21 | AC | 495 ms
170,716 KB |
testcase_22 | AC | 471 ms
172,620 KB |
testcase_23 | AC | 316 ms
134,024 KB |
testcase_24 | AC | 332 ms
140,948 KB |
testcase_25 | AC | 330 ms
140,440 KB |
testcase_26 | AC | 377 ms
150,516 KB |
testcase_27 | AC | 493 ms
182,392 KB |
testcase_28 | AC | 367 ms
149,728 KB |
testcase_29 | AC | 552 ms
196,092 KB |
ソースコード
import bisect import math def mark(s, x): for i in range(x + x, len(s), x): s[i] = False def sieve(n): s = [True] * n for x in range(2, int(n ** 0.5) + 1): if s[x]: mark(s, x) return [i for i in range(n) if s[i] and i > 1] def solve(): N = int(input()) ps = sieve(int(math.sqrt(N)) + 1) ys = [] i = 0 while i < len(ps): p = ps[i] d, m = divmod(N, p) if m == 0: ys.append(p) N = d if len(ys) >= 3: return True else: i += 1 if N > 1: ys.append(N) return len(ys) >= 3 def main(): print('YES' if solve() else 'NO') if __name__ == '__main__': main()