結果
問題 |
No.229 線分上を往復する3つの動点の一致
|
ユーザー |
|
提出日時 | 2016-11-22 17:52:15 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 22,528 KB |
最終ジャッジ日時 | 2024-11-27 09:40:26 |
合計ジャッジ時間 | 211,125 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 7 TLE * 33 |
ソースコード
#!/usr/bin/env python3 from fractions import Fraction def dir(v, t): x = v * t % 2 return x < 1 def pos(v, t): x = v * t % 2 return min(x, 2 - x) v1 = Fraction(2, int(input())) v2 = Fraction(2, int(input())) v3 = Fraction(2, int(input())) t = Fraction(0) while t == 0 or not (pos(v1, t) == pos(v2, t) == pos(v3, t)): assert pos(v1, t) == pos(v2, t) if dir(v1, t) == dir(v2, t) == True: # right l = 2 * (1 - pos(v1, t)) elif dir(v1, t) == dir(v2, t) == False: # left l = 2 * pos(v1, t) else: l = 2 t += l / (v1 + v2) print(t)