This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub Rin204/Library-Python
# verification-helper: PROBLEM https://judge.yosupo.jp/problem/sum_of_floor_of_linear from pathlib import Path import sys sys.path.append(str(Path(__file__).resolve().parent.parent.parent.parent)) def floor_sum(n, m, a, b): """ return \\sum_{i=0}^{n-1} ((a*i+b)//m) """ ret = 0 while True: if a >= m: ret += (n - 1) * n // 2 * (a // m) a %= m if b >= m: ret += n * (b // m) b %= m y_max = (a * n + b) // m if y_max == 0: return ret x_max = y_max * m - b ret += (n - (x_max + a - 1) // a) * y_max n, m, a, b = y_max, a, m, -x_max % a for _ in range(int(input())): n, m, a, b = map(int, input().split()) print(floor_sum(n, m, a, b))
Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/documentation/build.py", line 81, in _render_source_code_stat bundled_code = language.bundle( ^^^^^^^^^^^^^^^^ File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/python.py", line 108, in bundle raise NotImplementedError NotImplementedError