Neterukun's Library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub Neterukun1993/Library

:heavy_check_mark: TestCase/unittest/arithmetic_sequence.unittest.test.py

Depends on

Code

# verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A
import sys
input = sys.stdin.buffer.readline

from NumberTheory.Basic.arithmetic_sequence import Arithmetic


def naive_sum(a0, d, r):
    result = 0
    for i in range(r):
        result += a0 + i * d
    return result


def naive_range_sum(a0, d, l, r):
    result = 0
    for i in range(l, r):
        result += a0 + i * d
    return result


def main():
    for a0 in range(-10, 10):
        for d in range(-10, 10):
            for r in range(10):
                assert(Arithmetic.sum(a0, d, r) == naive_sum(a0, d, r))

    for a0 in range(-10, 10):
        for d in range(-10, 10):
            for l in range(10):
                for r in range(l, r):
                    assert(Arithmetic.range_sum(a0, d, l, r)
                           == naive_range_sum(a0, d, l, r))

if __name__ == '__main__':
    main()
    print("Hello World")
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
Back to top page