結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー nicklaw296
提出日時 2018-01-11 19:14:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 233 ms / 5,000 ms
コード長 512 bytes
コンパイル時間 1,797 ms
コンパイル使用メモリ 157,688 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-03 11:06:46
合計ジャッジ時間 8,070 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

long long int l[200005] = {0};

int main(){
    long long int n;
    cin >> n;
    for(int i=0;i<n;++i)cin >> l[i];
    long long int k;
    cin >> k;

    long double ok = 0, ng = 1e9 + 1;
    while(abs(ng-ok) > 1e-10){
        long double mid = (ok + ng) / 2.0;
        long long int cnt = 0;
        for(int i=0;i<n;++i)
            cnt += floor(l[i] / mid);
        if(cnt >= k)ok = mid;
        else ng = mid;
    }

    printf("%.10Lf\n",ok);

    return 0;
}
0