結果

問題 No.229 線分上を往復する3つの動点の一致
ユーザー convexineqconvexineq
提出日時 2020-12-29 08:15:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 945 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 54,272 KB
最終ジャッジ日時 2024-04-15 07:44:00
合計ジャッジ時間 3,583 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
54,112 KB
testcase_01 AC 40 ms
53,068 KB
testcase_02 AC 39 ms
52,900 KB
testcase_03 AC 38 ms
53,232 KB
testcase_04 AC 39 ms
53,820 KB
testcase_05 AC 39 ms
54,216 KB
testcase_06 AC 39 ms
53,532 KB
testcase_07 AC 38 ms
52,876 KB
testcase_08 AC 38 ms
53,696 KB
testcase_09 AC 39 ms
52,944 KB
testcase_10 AC 39 ms
54,048 KB
testcase_11 AC 39 ms
52,576 KB
testcase_12 AC 39 ms
53,496 KB
testcase_13 AC 39 ms
53,156 KB
testcase_14 AC 39 ms
53,076 KB
testcase_15 AC 38 ms
53,544 KB
testcase_16 AC 40 ms
52,520 KB
testcase_17 AC 38 ms
53,124 KB
testcase_18 AC 39 ms
53,260 KB
testcase_19 AC 39 ms
53,268 KB
testcase_20 AC 40 ms
52,564 KB
testcase_21 AC 39 ms
52,720 KB
testcase_22 AC 39 ms
52,768 KB
testcase_23 AC 38 ms
53,728 KB
testcase_24 AC 38 ms
53,204 KB
testcase_25 AC 40 ms
53,876 KB
testcase_26 AC 39 ms
53,888 KB
testcase_27 AC 40 ms
52,200 KB
testcase_28 AC 39 ms
53,884 KB
testcase_29 AC 39 ms
52,488 KB
testcase_30 AC 39 ms
52,392 KB
testcase_31 AC 39 ms
53,892 KB
testcase_32 AC 39 ms
53,540 KB
testcase_33 AC 39 ms
53,308 KB
testcase_34 AC 40 ms
54,272 KB
testcase_35 AC 39 ms
53,916 KB
testcase_36 AC 38 ms
53,816 KB
testcase_37 AC 40 ms
53,084 KB
testcase_38 AC 40 ms
52,828 KB
testcase_39 AC 39 ms
52,996 KB
testcase_40 AC 39 ms
54,220 KB
testcase_41 AC 38 ms
53,508 KB
testcase_42 AC 39 ms
53,332 KB
testcase_43 AC 39 ms
52,864 KB
testcase_44 AC 39 ms
53,112 KB
testcase_45 AC 40 ms
53,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(p,q,r,s):
    x = q*r//gcd(p*s,q*r)
    return x*p,q

def get(a,b):# 正面衝突、背面衝突が何秒ごとか?
    p1,q1 = a*b,a+b
    g = gcd(a,b)
    x,y = b//g, a//g
    if x%2 == y%2 == 1:
        t = 2*(x-x*(a+b)//2//b)
    else:
        t = 2*x - x*(a+b)//b
    p2, q2 = x*a, t        
    return [(p1,q1),(p2,q2)]


from math import gcd
a,b,c = map(int,open(0).read().split())
ans = [solve(p,q,r,s) for p,q in get(a,b) for r,s in get(a,c)]
ans.sort(key = lambda x: x[0]/x[1])
p,q = ans[0]
g = gcd(p,q)
print(f"{p//g}/{q//g}")
0