結果

問題 No.2352 Sharpened Knife in Fall
ユーザー maguroflymagurofly
提出日時 2023-06-16 21:51:51
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 369 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 11,504 KB
実行使用メモリ 17,276 KB
最終ジャッジ日時 2023-09-06 19:25:51
合計ジャッジ時間 19,006 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,508 KB
testcase_01 AC 76 ms
15,448 KB
testcase_02 AC 76 ms
15,556 KB
testcase_03 AC 74 ms
15,448 KB
testcase_04 WA -
testcase_05 AC 74 ms
15,404 KB
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 -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

R, K = gets.split.map(&:to_i)

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

ans = []
prev = -R
K.times do
  ac = R
  wa = prev
  s0 = f[prev]
  30.times do
    wj = (ac + wa) * 0.5
    if f[wj] - s0 >= s
      ac = wj
    else
      wa = wj
    end
  end
  ans << ac
  prev = ac
end

puts ans
0