結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
|
提出日時 | 2016-09-05 13:20:24 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 1,117 ms / 5,000 ms |
コード長 | 709 bytes |
コンパイル時間 | 2,758 ms |
コンパイル使用メモリ | 148,724 KB |
実行使用メモリ | 12,112 KB |
最終ジャッジ日時 | 2025-03-03 10:36:10 |
合計ジャッジ時間 | 23,737 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random, core.bitop; import std.string, std.conv, std.stdio, std.typecons; void main() { auto n = readln.chomp.to!long; auto li = readln.split.map!(to!long); auto k = readln.chomp.to!long; auto maxL = li.reduce!(max); bool calc(real x, real _) { long c = 0; foreach (l; li) { auto d = (l / x).floor; if (d >= long.max || d >= long.max - c || c + d >= k) return true; c += d.to!long; } return c >= k; } auto eps = 10.to!real ^^ (-10); auto r = iota(eps, maxL, eps).assumeSorted!(calc).lowerBound(0); writefln("%.9f", r.back); }