結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー tnakao0123tnakao0123
提出日時 2016-03-06 00:40:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 144 ms / 5,000 ms
コード長 965 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 83,672 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 23:36:39
合計ジャッジ時間 4,922 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 53 ms
6,944 KB
testcase_03 AC 99 ms
6,944 KB
testcase_04 AC 116 ms
6,944 KB
testcase_05 AC 115 ms
6,944 KB
testcase_06 AC 115 ms
6,944 KB
testcase_07 AC 137 ms
6,940 KB
testcase_08 AC 137 ms
6,940 KB
testcase_09 AC 137 ms
6,940 KB
testcase_10 AC 103 ms
6,940 KB
testcase_11 AC 110 ms
6,944 KB
testcase_12 AC 100 ms
6,940 KB
testcase_13 AC 126 ms
6,944 KB
testcase_14 AC 130 ms
6,940 KB
testcase_15 AC 116 ms
6,940 KB
testcase_16 AC 116 ms
6,944 KB
testcase_17 AC 115 ms
6,944 KB
testcase_18 AC 116 ms
6,944 KB
testcase_19 AC 137 ms
6,944 KB
testcase_20 AC 137 ms
6,940 KB
testcase_21 AC 137 ms
6,940 KB
testcase_22 AC 104 ms
6,940 KB
testcase_23 AC 109 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 4 ms
6,944 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 3 ms
6,940 KB
testcase_28 AC 23 ms
6,940 KB
testcase_29 AC 13 ms
6,940 KB
testcase_30 AC 4 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 67.cc: No.67 よくある棒を切る問題 (1) - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

typedef long long ll;

/* global variables */

int n;
double ls[MAX_N];
ll k;

/* subroutines */

ll cut(double l) {
  ll sum = 0;
  for (int i = 0; i < n; i++) sum += (ll)(ls[i] / l);
  return sum;
}

/* main */

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ls[i];
  cin >> k;

  double l0 = 0.0, l1 = 1e9;
  for (int i = 0; i < 100; i++) {
    double l = (l0 + l1) / 2;
    if (cut(l) < k) l1 = l;
    else l0 = l;
  }

  printf("%.14lf\n", l1);
  return 0;
}
0