結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー beet
提出日時 2018-11-27 20:39:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 180 ms / 5,000 ms
コード長 653 bytes
コンパイル時間 2,498 ms
コンパイル使用メモリ 194,108 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-03 11:20:30
合計ジャッジ時間 7,096 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct Precision{
  Precision(){
    cout<<fixed<<setprecision(12);
  }
}precision_beet;

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<double> l(n);
  for(Int i=0;i<n;i++) cin>>l[i];
  Int k;
  cin>>k;
  double L=l[0]/k,R=1e10;
  for(Int i=0;i<200;i++){
    double M=(L+R)/2;
    Int cnt=0;
    for(Int j=0;j<n;j++)
      cnt+=Int(l[j]/M);
    if(cnt>=k) L=M;
    else R=M;
  }
  cout<<L<<endl;
  return 0;
}
0