結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー ynyn
提出日時 2016-04-02 00:31:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,234 ms / 5,000 ms
コード長 558 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 89,088 KB
最終ジャッジ日時 2024-04-21 22:42:27
合計ジャッジ時間 22,049 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,541 ms
88,832 KB
testcase_01 AC 144 ms
88,192 KB
testcase_02 AC 132 ms
88,320 KB
testcase_03 AC 133 ms
87,936 KB
testcase_04 AC 962 ms
88,704 KB
testcase_05 AC 1,088 ms
88,704 KB
testcase_06 AC 216 ms
88,832 KB
testcase_07 AC 406 ms
88,704 KB
testcase_08 AC 1,169 ms
88,620 KB
testcase_09 AC 131 ms
88,320 KB
testcase_10 AC 130 ms
88,192 KB
testcase_11 AC 130 ms
87,936 KB
testcase_12 AC 1,208 ms
88,448 KB
testcase_13 AC 134 ms
89,088 KB
testcase_14 AC 133 ms
88,320 KB
testcase_15 AC 132 ms
88,320 KB
testcase_16 AC 2,234 ms
88,704 KB
testcase_17 AC 131 ms
88,320 KB
testcase_18 AC 137 ms
88,320 KB
testcase_19 AC 893 ms
88,832 KB
testcase_20 AC 135 ms
88,064 KB
testcase_21 AC 148 ms
88,704 KB
testcase_22 AC 347 ms
88,448 KB
testcase_23 AC 427 ms
88,704 KB
testcase_24 AC 140 ms
88,704 KB
testcase_25 AC 216 ms
88,448 KB
testcase_26 AC 214 ms
88,960 KB
testcase_27 AC 908 ms
88,704 KB
testcase_28 AC 602 ms
88,576 KB
testcase_29 AC 590 ms
88,832 KB
testcase_30 AC 233 ms
88,832 KB
testcase_31 AC 137 ms
88,832 KB
testcase_32 AC 147 ms
88,704 KB
testcase_33 AC 220 ms
88,704 KB
testcase_34 AC 209 ms
88,448 KB
testcase_35 AC 147 ms
88,704 KB
testcase_36 AC 190 ms
88,704 KB
testcase_37 AC 136 ms
88,448 KB
testcase_38 AC 154 ms
88,704 KB
testcase_39 AC 146 ms
88,448 KB
testcase_40 AC 140 ms
88,448 KB
testcase_41 AC 142 ms
88,704 KB
testcase_42 AC 145 ms
88,704 KB
testcase_43 AC 391 ms
89,056 KB
testcase_44 AC 191 ms
88,832 KB
testcase_45 AC 164 ms
88,704 KB
testcase_46 AC 157 ms
88,704 KB
testcase_47 AC 131 ms
88,320 KB
testcase_48 AC 136 ms
88,832 KB
testcase_49 AC 133 ms
88,704 KB
testcase_50 AC 138 ms
88,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import fractions

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

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

def reduce(p, q):
    common = gcd(p, q)
    return (p // common, q // common)


t1 = int(input())
t2 = int(input())
t3 = int(input())

t = lcm(t1, t2)
t = lcm(t, t3)

period = [t//t1, t//t2, t//t3]
period_min = min(period)

while period_min > 0:
    if period[0]%period_min == period[1]%period_min == period[2]%period_min:
        D = period_min
        break

    period_min -= 1

N, D = reduce(t, D)
print(str(N) + "/" + str(D))
0