結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー letrangerjpletrangerjp
提出日時 2017-06-18 13:53:49
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,489 ms / 5,000 ms
コード長 246 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 105,940 KB
最終ジャッジ日時 2024-04-26 00:01:34
合計ジャッジ時間 38,172 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,489 ms
99,304 KB
testcase_01 AC 86 ms
12,288 KB
testcase_02 AC 505 ms
33,280 KB
testcase_03 AC 871 ms
60,160 KB
testcase_04 AC 1,108 ms
79,232 KB
testcase_05 AC 1,090 ms
79,232 KB
testcase_06 AC 1,264 ms
88,448 KB
testcase_07 AC 1,177 ms
84,608 KB
testcase_08 AC 1,156 ms
84,608 KB
testcase_09 AC 1,331 ms
89,344 KB
testcase_10 AC 1,000 ms
70,656 KB
testcase_11 AC 1,045 ms
74,368 KB
testcase_12 AC 1,072 ms
76,544 KB
testcase_13 AC 1,082 ms
76,544 KB
testcase_14 AC 1,117 ms
78,848 KB
testcase_15 AC 1,117 ms
80,128 KB
testcase_16 AC 1,479 ms
88,576 KB
testcase_17 AC 1,550 ms
88,448 KB
testcase_18 AC 2,047 ms
87,548 KB
testcase_19 AC 1,698 ms
97,344 KB
testcase_20 AC 2,374 ms
63,076 KB
testcase_21 AC 2,314 ms
61,512 KB
testcase_22 AC 2,046 ms
103,200 KB
testcase_23 AC 1,941 ms
105,940 KB
testcase_24 AC 85 ms
12,160 KB
testcase_25 AC 109 ms
13,184 KB
testcase_26 AC 93 ms
12,288 KB
testcase_27 AC 90 ms
12,288 KB
testcase_28 AC 251 ms
24,832 KB
testcase_29 AC 165 ms
18,048 KB
testcase_30 AC 104 ms
13,440 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
L = gets.split.take(N).map(&:to_i)
K = gets.to_i
M = 10**9
last = L.sum.quo(K).ceil * M
LL = L.map{|v| v * M }

ans = (0..last).bsearch{|_i|
  i = last - _i
  sum = LL.map{|l| (l / i).floor }.sum
  sum >= K
}
p (last - ans).fdiv(M)
0