結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー nebukuro09nebukuro09
提出日時 2016-10-13 15:50:36
言語 D
(dmd 2.106.1)
結果
RE  
実行時間 -
コード長 535 bytes
コンパイル時間 2,251 ms
コンパイル使用メモリ 151,104 KB
実行使用メモリ 13,340 KB
最終ジャッジ日時 2023-09-02 22:21:30
合計ジャッジ時間 6,818 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 204 ms
12,640 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 195 ms
12,236 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 198 ms
11,328 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 168 ms
7,612 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 169 ms
11,344 KB
testcase_16 AC 195 ms
12,412 KB
testcase_17 AC 197 ms
13,264 KB
testcase_18 AC 195 ms
11,888 KB
testcase_19 AC 200 ms
12,048 KB
testcase_20 AC 198 ms
12,076 KB
testcase_21 AC 199 ms
11,524 KB
testcase_22 AC 175 ms
7,436 KB
testcase_23 AC 186 ms
12,564 KB
testcase_24 AC 1 ms
4,368 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 2 ms
4,368 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;

void main() {
  int N = to!int(chomp(readln()));
  int[] L = array(map!(to!int)(split(readln())));
  int K = to!int(chomp(readln()));

  real high = 1e9;
  real low = 0.0;
  real middle;
  int s;
  for (int i = 0; i < 80; i++) {
    s = 0;
    middle = (high+low)/2.0;
    for (int j = 0; j < N; j++)
      s += to!int(to!real(L[j])/middle);
    if (s >= K)
      low = middle;
    else
      high = middle;
  }
  writefln("%.9f", high);
}
0