結果
問題 | No.36 素数が嫌い! |
ユーザー | しらっ亭 |
提出日時 | 2015-07-29 03:01:45 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 646 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 10,872 KB |
実行使用メモリ | 109,284 KB |
最終ジャッジ日時 | 2023-09-24 21:22:17 |
合計ジャッジ時間 | 23,867 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 815 ms
55,768 KB |
testcase_01 | AC | 1,391 ms
87,260 KB |
testcase_02 | AC | 17 ms
8,104 KB |
testcase_03 | WA | - |
testcase_04 | AC | 16 ms
8,012 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 21 ms
8,564 KB |
testcase_08 | AC | 17 ms
8,596 KB |
testcase_09 | AC | 19 ms
8,888 KB |
testcase_10 | AC | 20 ms
8,744 KB |
testcase_11 | AC | 582 ms
42,076 KB |
testcase_12 | AC | 1,893 ms
109,284 KB |
testcase_13 | AC | 1,878 ms
109,064 KB |
testcase_14 | AC | 1,086 ms
71,460 KB |
testcase_15 | AC | 17 ms
8,020 KB |
testcase_16 | AC | 17 ms
7,972 KB |
testcase_17 | AC | 17 ms
8,036 KB |
testcase_18 | AC | 17 ms
8,076 KB |
testcase_19 | AC | 669 ms
48,480 KB |
testcase_20 | AC | 1,796 ms
109,000 KB |
testcase_21 | AC | 1,356 ms
85,840 KB |
testcase_22 | AC | 1,401 ms
88,292 KB |
testcase_23 | AC | 825 ms
56,764 KB |
testcase_24 | AC | 923 ms
62,232 KB |
testcase_25 | AC | 897 ms
61,208 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
ソースコード
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()) rtn = int(math.sqrt(N)) ps = sieve(rtn + 1) for p in ps: d, m = divmod(N, p) if m == 0: i = bisect.bisect_left(ps, d) if i >= len(ps) or ps[i] != d: return True return False def main(): print('YES' if solve() else 'NO') if __name__ == '__main__': main()