This documentation is automatically generated by online-judge-tools/verification-helper
$O(\sqrt n)$ で素数判定を行うアルゴリズム。
is_prime(x: int) -> bool
x
の素数判定結果 (True
: 素数である、False
: 素数ではない) を返す。計算量 $O(\sqrt n)$
def is_prime(x):
if x == 2:
return True
if x == 1 or x % 2 == 0:
return False
for k in range(3, int(x ** 0.5) + 1, 2):
if x % k == 0:
return False
return True
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
raise NotImplementedError
NotImplementedError