結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー なお
提出日時 2014-11-17 00:14:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 535 bytes
コンパイル時間 1,749 ms
コンパイル使用メモリ 157,520 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-03-03 10:08:57
合計ジャッジ時間 5,235 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))

int main(){
    int N; cin >> N;
    int L[200000];
    REP(i,N) cin >> L[i];
    ll K; cin >> K;

    double l = 0, r = 1e9;
    REP(j,100){
        double c = (l+r)/2;
        ll v = 0;
        REP(i,N) v+=(ll)(L[i]/c);
        if(v >= K) l = c; else r = c;
    }
    double res = (l+r)/2;
    cout << fixed << setprecision(15) << res << endl;
    return 0;
}
0