結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー simansiman
提出日時 2021-01-02 18:09:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,762 ms / 5,000 ms
コード長 270 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 26,496 KB
最終ジャッジ日時 2024-04-26 01:15:46
合計ジャッジ時間 65,099 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,728 ms
26,496 KB
testcase_01 AC 82 ms
12,544 KB
testcase_02 AC 1,084 ms
17,536 KB
testcase_03 AC 1,996 ms
22,784 KB
testcase_04 AC 2,736 ms
25,600 KB
testcase_05 AC 2,752 ms
25,600 KB
testcase_06 AC 2,751 ms
25,728 KB
testcase_07 AC 2,756 ms
26,240 KB
testcase_08 AC 2,730 ms
26,368 KB
testcase_09 AC 2,762 ms
26,112 KB
testcase_10 AC 2,475 ms
24,192 KB
testcase_11 AC 2,615 ms
24,704 KB
testcase_12 AC 2,391 ms
23,680 KB
testcase_13 AC 2,522 ms
25,088 KB
testcase_14 AC 2,621 ms
25,600 KB
testcase_15 AC 2,363 ms
24,320 KB
testcase_16 AC 2,721 ms
25,728 KB
testcase_17 AC 2,754 ms
25,728 KB
testcase_18 AC 2,714 ms
25,728 KB
testcase_19 AC 2,726 ms
26,496 KB
testcase_20 AC 2,743 ms
26,368 KB
testcase_21 AC 2,751 ms
26,240 KB
testcase_22 AC 2,472 ms
24,192 KB
testcase_23 AC 2,580 ms
24,704 KB
testcase_24 AC 85 ms
12,544 KB
testcase_25 AC 136 ms
12,416 KB
testcase_26 AC 104 ms
12,544 KB
testcase_27 AC 97 ms
12,672 KB
testcase_28 AC 532 ms
14,336 KB
testcase_29 AC 294 ms
13,056 KB
testcase_30 AC 143 ms
12,544 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
L = gets.split.map(&:to_i)
K = gets.to_i

def f(x)
  cnt = 0

  L.each do |l|
    cnt += (l / x).floor
  end

  K <= cnt
end

ok = 0.0
ng = 10.0 ** 18

100.times do
  x = (ok + ng) / 2.0

  if f(x)
    ok = x
  else
    ng = x
  end
end

puts ok.round(12)
0