結果

問題 No.229 線分上を往復する3つの動点の一致
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-06-21 17:37:58
言語 Python2
(2.7.18)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 503 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 6,656 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2023-09-21 22:49:20
合計ジャッジ時間 4,049 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
7,824 KB
testcase_01 AC 23 ms
7,768 KB
testcase_02 AC 23 ms
7,740 KB
testcase_03 AC 22 ms
7,796 KB
testcase_04 AC 23 ms
7,788 KB
testcase_05 AC 22 ms
7,620 KB
testcase_06 AC 23 ms
7,644 KB
testcase_07 AC 32 ms
7,752 KB
testcase_08 AC 33 ms
7,656 KB
testcase_09 AC 28 ms
7,640 KB
testcase_10 AC 33 ms
7,620 KB
testcase_11 AC 33 ms
7,608 KB
testcase_12 AC 33 ms
7,644 KB
testcase_13 AC 32 ms
7,680 KB
testcase_14 AC 31 ms
7,644 KB
testcase_15 AC 33 ms
7,788 KB
testcase_16 AC 32 ms
7,736 KB
testcase_17 AC 30 ms
7,732 KB
testcase_18 AC 31 ms
7,824 KB
testcase_19 AC 28 ms
7,824 KB
testcase_20 AC 28 ms
7,788 KB
testcase_21 AC 31 ms
7,844 KB
testcase_22 AC 32 ms
7,640 KB
testcase_23 AC 31 ms
7,640 KB
testcase_24 AC 31 ms
7,832 KB
testcase_25 AC 31 ms
7,624 KB
testcase_26 AC 30 ms
7,840 KB
testcase_27 AC 24 ms
7,848 KB
testcase_28 AC 30 ms
7,788 KB
testcase_29 AC 32 ms
7,784 KB
testcase_30 AC 32 ms
7,620 KB
testcase_31 AC 29 ms
7,772 KB
testcase_32 AC 32 ms
7,736 KB
testcase_33 AC 25 ms
7,792 KB
testcase_34 AC 27 ms
7,828 KB
testcase_35 AC 32 ms
7,616 KB
testcase_36 AC 31 ms
7,592 KB
testcase_37 AC 30 ms
7,620 KB
testcase_38 AC 29 ms
7,620 KB
testcase_39 AC 24 ms
7,692 KB
testcase_40 AC 30 ms
7,612 KB
testcase_41 AC 31 ms
7,772 KB
testcase_42 AC 28 ms
7,732 KB
testcase_43 AC 28 ms
7,628 KB
testcase_44 AC 28 ms
7,624 KB
testcase_45 AC 29 ms
7,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from fractions import gcd, Fraction
lcm = lambda a, b: a * b / gcd(a, b)
lcmx = lambda arr: reduce(lcm, arr)

t1 = int(raw_input())
t2 = int(raw_input())
t3 = int(raw_input())
lm = lcmx((t1, t2, t3))
vs = map(lambda t: lm / t, (t1, t2, t3))
for d in reversed(xrange(max(t1, t2, t3))):
    r1, r2, r3 = map(lambda v: v % d, vs)
    if r1 == r2 or r1 == d-r2:
        if r1 == r3 or r1 == d-r3:
            break
res = Fraction(lm, d)
print '{}/{}'.format(res.numerator, res.denominator)
0