結果
| 問題 | No.356 円周上を回る3つの動点の一致 |
| コンテスト | |
| ユーザー |
yn
|
| 提出日時 | 2016-04-02 00:33:24 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 558 bytes |
| 記録 | |
| コンパイル時間 | 201 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 18,084 KB |
| 最終ジャッジ日時 | 2024-10-02 09:14:31 |
| 合計ジャッジ時間 | 12,648 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 47 |
ソースコード
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))
yn