結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー しらっ亭しらっ亭
提出日時 2016-03-11 00:46:40
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,140 bytes
コンパイル時間 1,288 ms
コンパイル使用メモリ 159,360 KB
実行使用メモリ 8,328 KB
最終ジャッジ日時 2023-10-24 23:07:32
合計ジャッジ時間 14,706 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FORR(x,arr) for(auto&& x:arr)
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i,n) for (int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
typedef long long ll;
// -------------------------------------

ll N, K;
int L[201010];

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N;
  int ma = 0;
  REP(i, N) {
    cin >> L[i];
    ma = max(ma, L[i]);
  }
  cin >> K;

  double l = 1.0 * L[0] / K;
  double r = ma+1;

  double eps = 1e-9;
  double eps1 = 1+eps;

  while (r > l + eps || r > l * eps1) {
    double m = (l + r) / 2;
    ll n = 0;
    REP(i, N) {
      n += (ll) (L[i] / m);
    }
    if (n >= K) l = m;
    else r = m;
  }

  _P("%.10f\n", (l + r) / 2);

  return 0;
}
0