結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー shoshoshoshoshosho
提出日時 2020-02-14 15:15:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 627 bytes
コンパイル時間 1,628 ms
コンパイル使用メモリ 162,684 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2024-04-16 00:16:56
合計ジャッジ時間 11,053 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 170 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 65 ms
6,944 KB
testcase_03 AC 123 ms
6,940 KB
testcase_04 AC 146 ms
6,940 KB
testcase_05 AC 146 ms
6,940 KB
testcase_06 AC 146 ms
6,944 KB
testcase_07 AC 169 ms
6,944 KB
testcase_08 AC 170 ms
6,944 KB
testcase_09 AC 169 ms
6,940 KB
testcase_10 AC 131 ms
6,944 KB
testcase_11 AC 139 ms
6,944 KB
testcase_12 AC 126 ms
6,940 KB
testcase_13 AC 155 ms
6,944 KB
testcase_14 AC 161 ms
6,940 KB
testcase_15 AC 144 ms
6,944 KB
testcase_16 TLE -
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;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  ll n;cin>>n;
  ll l[n];rep(i,0,n)cin>>l[i];
  ll k;cin>>k;

  lb ok=0,ng=1e9;
  while(ng-ok>1e-12){
    lb mid=(ok+ng)/2;

    ll sum=0;
    rep(i,0,n)sum+=l[i]/mid;

    if(sum>=k)ok=mid;
    else ng=mid;
  }

  out(setprecision(12)<<ok);


  return 0;
}
0