結果

問題 No.1980 [Cherry 4th Tune D] 停止距離
ユーザー TKG1
提出日時 2022-06-17 22:23:38
言語 Crystal
(1.14.0)
結果
TLE  
実行時間 -
コード長 604 bytes
コンパイル時間 19,104 ms
コンパイル使用メモリ 344,888 KB
実行使用メモリ 13,640 KB
最終ジャッジ日時 2024-10-09 08:32:41
合計ジャッジ時間 26,932 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

# require "debug"
require "big"
alias LL = Int64
macro chmin(x, y); {{x}} = {{y}} if {{x}} > {{y}}; end
macro chmax(x, y); {{x}} = {{y}} if {{x}} < {{y}}; end
macro yn(x); {{x}} ? "Yes" : "No"; end

# ---------------------------------------------------- :)

def f(t,u,v)
  return v*t + (v*v)/(u*20)
end

read_line.to_i.times do
  t, u, l = read_line.split.map(&.to_big_f)
  ng = 0.to_big_f
  ok = 10000000000.to_big_f
  while ok-ng > 0.0000000000000000001
    mid = (ok+ng)/2
    if f(t,u,mid) <= l
      ng = mid
    else
      ok = mid
    end
  end
  x = ((ng*360).to_i)/100
  printf("%.2f\n", x)
end
0