結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,460 KB
testcase_01 AC 72 ms
15,408 KB
testcase_02 AC 76 ms
15,484 KB
testcase_03 AC 73 ms
15,308 KB
testcase_04 TLE -
testcase_05 AC 80 ms
15,372 KB
testcase_06 TLE -
testcase_07 AC 1,831 ms
16,784 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 1,718 ms
16,828 KB
testcase_15 TLE -
testcase_16 AC 243 ms
15,916 KB
testcase_17 AC 160 ms
15,596 KB
testcase_18 AC 1,320 ms
16,628 KB
testcase_19 AC 2,843 ms
17,156 KB
testcase_20 AC 1,157 ms
16,564 KB
testcase_21 AC 1,104 ms
16,724 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