結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー gigurururugigurururu
提出日時 2014-11-25 13:24:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,570 ms / 5,000 ms
コード長 201 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 87,168 KB
最終ジャッジ日時 2024-04-25 23:12:31
合計ジャッジ時間 29,375 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 992 ms
60,544 KB
testcase_01 AC 85 ms
12,288 KB
testcase_02 AC 575 ms
33,280 KB
testcase_03 AC 1,053 ms
62,080 KB
testcase_04 AC 1,570 ms
86,144 KB
testcase_05 AC 1,493 ms
86,272 KB
testcase_06 AC 1,275 ms
81,664 KB
testcase_07 AC 1,365 ms
87,040 KB
testcase_08 AC 1,374 ms
87,168 KB
testcase_09 AC 1,191 ms
76,160 KB
testcase_10 AC 1,324 ms
81,664 KB
testcase_11 AC 1,377 ms
86,912 KB
testcase_12 AC 1,112 ms
70,656 KB
testcase_13 AC 1,263 ms
79,360 KB
testcase_14 AC 1,307 ms
81,920 KB
testcase_15 AC 1,025 ms
66,816 KB
testcase_16 AC 1,042 ms
65,920 KB
testcase_17 AC 982 ms
62,720 KB
testcase_18 AC 930 ms
59,648 KB
testcase_19 AC 948 ms
60,544 KB
testcase_20 AC 941 ms
60,416 KB
testcase_21 AC 939 ms
60,416 KB
testcase_22 AC 867 ms
53,504 KB
testcase_23 AC 903 ms
56,448 KB
testcase_24 AC 80 ms
12,288 KB
testcase_25 AC 105 ms
13,696 KB
testcase_26 AC 89 ms
12,672 KB
testcase_27 AC 90 ms
12,288 KB
testcase_28 AC 298 ms
26,240 KB
testcase_29 AC 189 ms
19,328 KB
testcase_30 AC 111 ms
13,696 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets
la=gets.split.map(&:to_i)
k=gets.to_i

eps=1e-9
l=0.0
r=1e9

while [(l-r).abs,(l-r).abs/r].all?{|d|d>eps}
  c=(l+r)/2
  la.map{|i|(i/c).to_i}.inject(:+)>=k ?(l=c):(r=c)
end

p (l+r)/2
0