結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー shoshoshoshoshosho
提出日時 2020-02-14 15:16:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 165 ms / 5,000 ms
コード長 627 bytes
コンパイル時間 1,738 ms
コンパイル使用メモリ 166,816 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 13:10:12
合計ジャッジ時間 6,421 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

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-10){
    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