結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,496 KB
testcase_01 AC 73 ms
15,472 KB
testcase_02 AC 74 ms
15,464 KB
testcase_03 AC 74 ms
15,400 KB
testcase_04 TLE -
testcase_05 AC 76 ms
15,424 KB
testcase_06 TLE -
testcase_07 AC 1,837 ms
16,692 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 1,739 ms
16,704 KB
testcase_15 TLE -
testcase_16 AC 240 ms
15,732 KB
testcase_17 AC 155 ms
15,824 KB
testcase_18 AC 1,363 ms
16,688 KB
testcase_19 AC 2,891 ms
16,904 KB
testcase_20 AC 1,183 ms
16,628 KB
testcase_21 AC 1,113 ms
16,740 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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]
  100.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