competitive-programming-library

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

View the Project on GitHub kmyk/competitive-programming-library

:warning: python/rational-gcd.py

Code

from fractions import Fraction
import math
def lcm(a, b):
    return a * b // math.gcd(a, b)

# https://kimiyuki.net/blog/2016/06/08/yuki-356/
def qlcm(p, q):
    a = p.numerator * q.denominator
    b = p.denominator * q.numerator
    c = p.denominator * q.denominator
    return Fraction(lcm(a, b), c)
def qgcd(p, q):
    return p * q / qlcm(p, q)
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/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.9.6/x64/lib/python3.9/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page