結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,396 KB
testcase_01 AC 76 ms
15,344 KB
testcase_02 AC 77 ms
15,392 KB
testcase_03 AC 76 ms
15,476 KB
testcase_04 TLE -
testcase_05 AC 78 ms
15,436 KB
testcase_06 TLE -
testcase_07 AC 1,962 ms
16,640 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 1,859 ms
16,732 KB
testcase_15 TLE -
testcase_16 AC 269 ms
15,900 KB
testcase_17 AC 170 ms
15,824 KB
testcase_18 AC 1,438 ms
16,780 KB
testcase_19 TLE -
testcase_20 AC 1,247 ms
16,596 KB
testcase_21 AC 1,184 ms
16,620 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