結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー k
提出日時 2021-03-10 22:59:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 384 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 54,200 KB
最終ジャッジ日時 2024-10-12 12:50:01
合計ジャッジ時間 3,785 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

def lcm(a, b):
    return a // gcd(a, b) * b

def main():
    t1 = int(input())
    t2 = int(input())
    t3 = int(input())

    p1, q1 = t1 * t2, t2 - t1
    p2, q2 = t1 * t3, t3 - t1

    q = lcm(q1, q2)
    p1 *= q // q1
    p2 *= q // q2
    p = lcm(p1, p2)

    g = gcd(p, q)
    print("{}/{}".format(p // g, q // g))

if __name__ == "__main__":
    main()
0