library_for_python

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

View the Project on GitHub Kazun1998/library_for_python

:heavy_check_mark: test_verify/yosupo_library_checker/Math/Rational_Approximation.test.py

Depends on

Code

# verification-helper: PROBLEM https://judge.yosupo.jp/problem/rational_approximation

#==================================================
from Stern_Brocot_Tree import *

import sys
input=sys.stdin.readline
write=sys.stdout.write

#==================================================
def verify():
    T = int(input())

    for _ in range(T):
        N, x, y = map(int, input().split())
        _, _, c, d = Stern_Brocot_Tree.binary_search_range_increase(N, lambda a, b: a * y >= b * x)
        a, b, _, _ = Stern_Brocot_Tree.binary_search_range_increase(N, lambda a, b: a * y > b * x)
        yield f"{a} {b} {c} {d}"

#==================================================

write("\n".join(map(str, verify())))
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.5/x64/lib/python3.13/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.13.5/x64/lib/python3.13/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page