結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー te-shte-sh
提出日時 2016-09-05 12:16:14
言語 D
(dmd 2.106.1)
結果
RE  
実行時間 -
コード長 602 bytes
コンパイル時間 2,633 ms
コンパイル使用メモリ 161,148 KB
実行使用メモリ 13,532 KB
最終ジャッジ日時 2023-09-02 21:54:54
合計ジャッジ時間 26,352 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 979 ms
11,860 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 943 ms
11,316 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 941 ms
12,060 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 815 ms
6,704 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 813 ms
10,652 KB
testcase_16 AC 928 ms
11,404 KB
testcase_17 AC 927 ms
12,168 KB
testcase_18 AC 914 ms
12,420 KB
testcase_19 AC 913 ms
10,316 KB
testcase_20 AC 883 ms
10,600 KB
testcase_21 AC 881 ms
10,792 KB
testcase_22 AC 820 ms
6,900 KB
testcase_23 AC 870 ms
11,604 KB
testcase_24 AC 2 ms
4,372 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 7 ms
4,372 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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 _) {
    auto c = 0;
    foreach (l; li)
      c += (l / x).floor.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);
}
0