結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,069 ms
88,960 KB
testcase_01 AC 184 ms
88,192 KB
testcase_02 AC 183 ms
88,320 KB
testcase_03 AC 183 ms
88,576 KB
testcase_04 AC 2,233 ms
88,960 KB
testcase_05 AC 2,497 ms
88,960 KB
testcase_06 AC 325 ms
88,704 KB
testcase_07 AC 622 ms
88,832 KB
testcase_08 AC 1,340 ms
88,832 KB
testcase_09 AC 194 ms
88,576 KB
testcase_10 AC 186 ms
88,576 KB
testcase_11 AC 187 ms
88,576 KB
testcase_12 AC 1,351 ms
88,832 KB
testcase_13 AC 2,515 ms
88,832 KB
testcase_14 AC 1,357 ms
88,960 KB
testcase_15 AC 189 ms
88,832 KB
testcase_16 AC 2,501 ms
88,704 KB
testcase_17 AC 332 ms
88,832 KB
testcase_18 AC 182 ms
88,576 KB
testcase_19 AC 1,224 ms
88,832 KB
testcase_20 AC 191 ms
88,704 KB
testcase_21 AC 217 ms
88,960 KB
testcase_22 AC 789 ms
88,832 KB
testcase_23 AC 1,045 ms
88,960 KB
testcase_24 AC 272 ms
88,960 KB
testcase_25 AC 461 ms
88,960 KB
testcase_26 AC 407 ms
88,704 KB
testcase_27 AC 1,680 ms
88,704 KB
testcase_28 AC 1,698 ms
88,704 KB
testcase_29 AC 1,791 ms
88,832 KB
testcase_30 AC 383 ms
88,704 KB
testcase_31 AC 216 ms
88,832 KB
testcase_32 AC 217 ms
88,832 KB
testcase_33 AC 566 ms
88,960 KB
testcase_34 AC 1,235 ms
88,832 KB
testcase_35 AC 255 ms
89,088 KB
testcase_36 AC 643 ms
88,960 KB
testcase_37 AC 181 ms
88,704 KB
testcase_38 AC 219 ms
88,960 KB
testcase_39 AC 237 ms
88,960 KB
testcase_40 AC 184 ms
88,704 KB
testcase_41 AC 229 ms
88,960 KB
testcase_42 AC 195 ms
88,832 KB
testcase_43 AC 656 ms
88,960 KB
testcase_44 AC 269 ms
88,960 KB
testcase_45 AC 445 ms
88,832 KB
testcase_46 AC 335 ms
88,704 KB
testcase_47 AC 190 ms
88,832 KB
testcase_48 AC 185 ms
88,960 KB
testcase_49 AC 189 ms
88,832 KB
testcase_50 AC 182 ms
88,832 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_max = max(period) - 1

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

    period_max -= 1

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