結果
| 問題 | No.67 よくある棒を切る問題 (1) | 
| コンテスト | |
| ユーザー |  hogeover30 | 
| 提出日時 | 2015-03-09 02:21:59 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 128 ms / 5,000 ms | 
| コード長 | 558 bytes | 
| コンパイル時間 | 720 ms | 
| コンパイル使用メモリ | 59,964 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2025-03-03 10:17:27 | 
| 合計ジャッジ時間 | 4,373 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 30 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
int N, L[200010];
ll K;
bool func(double x)
{
    ll cnt=0;
    for(int i=0;i<N;++i)
        cnt+=(ll)(L[i]/x);
    return cnt>=K;
}
int main()
{
    while (cin>>N) {
        for(int i=0;i<N;++i) cin>>L[i];
        cin>>K;
        double lb=0, ub=1e11;
        for(int $=0;$<100;++$) {
            double x=(ub+lb)*0.5;
            if (func(x))
                lb=x;
            else
                ub=x;
        }
        printf("%.10f\n", lb);
    }
}
            
            
            
        