結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー sio_puyosio_puyo
提出日時 2014-11-16 23:50:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 225 ms / 5,000 ms
コード長 1,172 bytes
コンパイル時間 1,310 ms
コンパイル使用メモリ 161,784 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-25 23:06:13
合計ジャッジ時間 7,663 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 224 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 90 ms
6,940 KB
testcase_03 AC 164 ms
6,944 KB
testcase_04 AC 206 ms
6,940 KB
testcase_05 AC 201 ms
6,940 KB
testcase_06 AC 205 ms
6,940 KB
testcase_07 AC 219 ms
6,940 KB
testcase_08 AC 223 ms
6,940 KB
testcase_09 AC 222 ms
6,944 KB
testcase_10 AC 186 ms
6,940 KB
testcase_11 AC 190 ms
6,940 KB
testcase_12 AC 166 ms
6,944 KB
testcase_13 AC 201 ms
6,940 KB
testcase_14 AC 220 ms
6,944 KB
testcase_15 AC 198 ms
6,940 KB
testcase_16 AC 205 ms
6,940 KB
testcase_17 AC 201 ms
6,948 KB
testcase_18 AC 198 ms
6,940 KB
testcase_19 AC 224 ms
6,944 KB
testcase_20 AC 225 ms
6,940 KB
testcase_21 AC 217 ms
6,944 KB
testcase_22 AC 183 ms
6,944 KB
testcase_23 AC 193 ms
6,940 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 6 ms
6,944 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 36 ms
6,940 KB
testcase_29 AC 19 ms
6,944 KB
testcase_30 AC 6 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  int n;
  cin >> n;
  vector<double> l;
  l.resize(n);
  double left=0,right=0;
  REP(i,n) cin >> l[i];
  LL k;
  cin >> k;
  REP(i,n) left=max(left,l[i]);
  left/=k;
  REP(i,n) right+=l[i];
  right/=k;
  REP(loop,100){
    double tmp=(left+right)/2;
    LL stick=0;
    REP(i,l.size()) stick+=l[i]/tmp;
    if(stick<k) right=tmp;
    else left=tmp;
  }
  cout << fixed<<setprecision(10) << (left+right)/2 << endl;
  return 0;
}
0