結果

問題 No.2352 Sharpened Knife in Fall
ユーザー maguroflymagurofly
提出日時 2023-06-16 21:55:52
言語 Crystal
(1.11.2)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 19,726 ms
コンパイル使用メモリ 257,836 KB
実行使用メモリ 4,956 KB
最終ジャッジ日時 2023-09-06 19:37:14
合計ジャッジ時間 20,698 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,676 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

R = 1
K = 2

R2 = R * R * 1.0
f = ->(y: Float64) { dy = Math.sqrt(R2 - y * y); (y * dy + R2 * Math.atan(y / dy)) }
s = Math::PI * R2 / (K + 1)

ans = [] of Float64
prev = -R.to_f64
K.times do
  ac = R.to_f64
  wa = prev
  s0 = f.call(prev)
  100.times do
    wj = (ac + wa) * 0.5
    if f.call(wj) - s0 >= s
      ac = wj
    else
      wa = wj
    end
  end
  puts ac
  prev = ac
end
0