結果
問題 | No.36 素数が嫌い! |
ユーザー | しらっ亭 |
提出日時 | 2015-07-29 03:18:40 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,997 ms / 5,000 ms |
コード長 | 740 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 10,700 KB |
実行使用メモリ | 109,320 KB |
最終ジャッジ日時 | 2023-09-09 07:16:29 |
合計ジャッジ時間 | 25,197 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 911 ms
55,836 KB |
testcase_01 | AC | 1,474 ms
87,236 KB |
testcase_02 | AC | 17 ms
8,636 KB |
testcase_03 | AC | 17 ms
8,640 KB |
testcase_04 | AC | 17 ms
8,504 KB |
testcase_05 | AC | 21 ms
8,720 KB |
testcase_06 | AC | 22 ms
8,728 KB |
testcase_07 | AC | 22 ms
8,656 KB |
testcase_08 | AC | 18 ms
8,000 KB |
testcase_09 | AC | 19 ms
8,708 KB |
testcase_10 | AC | 20 ms
8,720 KB |
testcase_11 | AC | 635 ms
42,064 KB |
testcase_12 | AC | 1,973 ms
109,320 KB |
testcase_13 | AC | 1,997 ms
109,100 KB |
testcase_14 | AC | 1,057 ms
71,384 KB |
testcase_15 | AC | 17 ms
8,644 KB |
testcase_16 | AC | 17 ms
8,520 KB |
testcase_17 | AC | 16 ms
8,604 KB |
testcase_18 | AC | 17 ms
7,980 KB |
testcase_19 | AC | 763 ms
48,376 KB |
testcase_20 | AC | 1,951 ms
108,896 KB |
testcase_21 | AC | 1,501 ms
85,868 KB |
testcase_22 | AC | 1,571 ms
88,248 KB |
testcase_23 | AC | 933 ms
56,636 KB |
testcase_24 | AC | 947 ms
62,240 KB |
testcase_25 | AC | 1,023 ms
61,300 KB |
testcase_26 | AC | 1,198 ms
70,092 KB |
testcase_27 | AC | 1,682 ms
95,040 KB |
testcase_28 | AC | 1,174 ms
68,884 KB |
testcase_29 | AC | 1,934 ms
105,804 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()