結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー letrangerjpletrangerjp
提出日時 2017-06-18 13:12:48
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,018 ms / 5,000 ms
コード長 243 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 87,808 KB
最終ジャッジ日時 2024-04-25 23:58:22
合計ジャッジ時間 48,536 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,004 ms
87,808 KB
testcase_01 AC 88 ms
12,160 KB
testcase_02 AC 802 ms
39,168 KB
testcase_03 AC 1,463 ms
79,360 KB
testcase_04 AC 1,981 ms
86,912 KB
testcase_05 AC 1,979 ms
86,912 KB
testcase_06 AC 2,014 ms
87,040 KB
testcase_07 AC 1,983 ms
87,680 KB
testcase_08 AC 1,981 ms
87,680 KB
testcase_09 AC 1,992 ms
87,680 KB
testcase_10 AC 1,794 ms
83,072 KB
testcase_11 AC 1,892 ms
85,504 KB
testcase_12 AC 1,724 ms
83,072 KB
testcase_13 AC 1,822 ms
83,584 KB
testcase_14 AC 1,889 ms
86,272 KB
testcase_15 AC 1,702 ms
82,560 KB
testcase_16 AC 1,989 ms
86,912 KB
testcase_17 AC 1,980 ms
86,912 KB
testcase_18 AC 1,979 ms
86,784 KB
testcase_19 AC 1,986 ms
87,680 KB
testcase_20 AC 2,018 ms
87,808 KB
testcase_21 AC 1,983 ms
87,552 KB
testcase_22 AC 1,794 ms
82,944 KB
testcase_23 AC 1,926 ms
87,040 KB
testcase_24 AC 89 ms
12,288 KB
testcase_25 AC 128 ms
13,824 KB
testcase_26 AC 104 ms
12,672 KB
testcase_27 AC 101 ms
12,544 KB
testcase_28 AC 396 ms
29,568 KB
testcase_29 AC 241 ms
20,736 KB
testcase_30 AC 131 ms
13,952 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
L = gets.split.take(N).map(&:to_i)
K = gets.to_i
start = 0.0
last = L.sum.quo(K).ceil * 1.0

count = 0
ans = (start..last).bsearch{|_i|
  i = last - _i
  sum = L.map{|l| (l / i).floor }.sum
  count += 1
  sum >= K
}
p last - ans
0